From 57e830467f9279ee3189755d1566809cbc8d9247 Mon Sep 17 00:00:00 2001 From: Chris Tan Date: Fri, 7 Oct 2011 00:12:59 -0700 Subject: [PATCH] Implemented fix written by Bartosz Grzesiak for this problem: http://getsatisfaction.com/galleria/topics/could_not_extract_width_height_from_image_in_webkit_browsers#reply_6547568 --- src/galleria.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/galleria.js b/src/galleria.js index ef452cdf..fd399185 100644 --- a/src/galleria.js +++ b/src/galleria.js @@ -4790,11 +4790,13 @@ Galleria.Picture.prototype = { if ( ( !this.width || !this.height ) ) { window.setTimeout( (function( img ) { return function() { - if ( img.width && img.height ) { - complete.call( img ); - } else { - Galleria.raise('Could not extract width/height from image: ' + img.src + - '. Traced measures: width:' + img.width + 'px, height: ' + img.height + 'px.'); + try { + $('').attr('src', $(img).attr('src')).load(function() { + complete.call( this ); + }); + } catch( error_message ) { + Galleria.raise('Could not extract width/height from image: ' + img.src + + '. Traced measures: width:' + img.width + 'px, height: ' + img.height + 'px.'); } }; }( this )), 2);