Index: ui/file_manager/gallery/js/image_editor/image_view.js |
diff --git a/ui/file_manager/gallery/js/image_editor/image_view.js b/ui/file_manager/gallery/js/image_editor/image_view.js |
index fe289a0d6bc5d67ed1e69fd18b28c2e71fe3454a..c5c1af59f761d1da69fc22c720f3bed7ca9fc22c 100644 |
--- a/ui/file_manager/gallery/js/image_editor/image_view.js |
+++ b/ui/file_manager/gallery/js/image_editor/image_view.js |
@@ -403,13 +403,24 @@ ImageView.prototype.load = function(entry, metadata, effect, |
function displayThumbnail(loadType, canvas) { |
if (canvas) { |
+ var width = null; |
+ var height = null; |
+ if (metadata.media) { |
+ width = metadata.media.width; |
+ height = metadata.media.height; |
+ } |
+ // If metadata.drive.present is true, the image data is loaded directly |
+ // from local cache, whose size may be out of sync with the drive |
+ // metadata. |
+ if (metadata.drive && !metadata.drive.present) { |
+ width = metadata.drive.imageWidth; |
+ height = metadata.drive.imageHeight; |
+ } |
self.replace( |
canvas, |
effect, |
- (metadata.media && metadata.media.width) || |
- metadata.drive.imageWidth, |
- (metadata.media && metadata.media.height) || |
- metadata.drive.imageHeight, |
+ width, |
+ height, |
true /* preview */); |
if (displayCallback) displayCallback(); |
} |