From 506ea5055e0d9c6ce037f0db85c850d4027ef528 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Thu, 13 Nov 2014 14:18:40 +0300 Subject: [PATCH] Fixed invalid image src --- app/js/directives.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/js/directives.js b/app/js/directives.js index 7305412f..07115821 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1427,11 +1427,11 @@ angular.module('myApp.directives', ['myApp.filters']) var jump = 0; $scope.$watchCollection('fullPhoto.location', function () { - var cachedSrc = MtpApiFileManager.getCachedFile($scope.thumbLocation), + var cachedBlob = MtpApiFileManager.getCachedFile($scope.thumbLocation), curJump = ++jump; - if (cachedSrc) { - imgElement.src = cachedSrc; + if (cachedBlob) { + imgElement.src = FileManager.getUrl(cachedBlob, 'image/jpeg'); resize(); } else { imgElement.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; @@ -1636,7 +1636,10 @@ angular.module('myApp.directives', ['myApp.filters']) $scope.imageWidth = wh.w; $scope.imageHeight = wh.h; - $scope.thumbSrc = MtpApiFileManager.getCachedFile(thumbPhotoSize.location); + var cachedBlob = MtpApiFileManager.getCachedFile(thumbPhotoSize.location); + if (cachedBlob) { + $scope.thumbSrc = FileManager.getUrl(cachedBlob, 'image/jpeg'); + } } $scope.frameWidth = Math.max($scope.imageWidth, Math.min(600, fullWidth))