Fixed ImageViewer not properly loading images in Chrome
authorAlexander Ebert <ebert@woltlab.com>
Wed, 11 Mar 2015 10:33:27 +0000 (11:33 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 11 Mar 2015 10:33:27 +0000 (11:33 +0100)
wcfsetup/install/files/js/WCF.ImageViewer.js

index 77512206ccb5224d2878eae1893ba339947cb469..2c485ed73d3a40fe191b5ed34e2dcf8adbba5c76 100644 (file)
@@ -720,24 +720,13 @@ $.widget('ui.wcfImageViewer', {
                }
                
                if (this.options.staticViewer && !imageData.image.height && $image[0].complete) {
-                       var $img = new Image();
-                       $img.src = imageData.image.url;
-                       
-                       // Chrome on iOS seems to not fetch images from cache
-                       if (navigator.userAgent.match(/CriOS/)) {
-                               var self = this;
-                               $img.onload = function() {
-                                       imageData.image.height = this.height;
-                                       imageData.image.width = this.width;
-                                       
-                                       self._renderImage(targetIndex, imageData, containerDimensions);
-                               };
-                               
-                               return;
-                       }
+                       $image.css({
+                               height: 'auto',
+                               width: 'auto'
+                       });
                        
-                       imageData.image.height = $img.height;
-                       imageData.image.width = $img.width;
+                       imageData.image.height = $image[0].height;
+                       imageData.image.width = $image[0].width;
                }
                
                var $height = imageData.image.height;