Browse Source

MessageMedia directive: Use cached animgif URI

Danilo Bargen 7 years ago
parent
commit
d40b152019
2 changed files with 8 additions and 4 deletions
  1. 1 1
      src/directives/message_media.html
  2. 7 3
      src/directives/message_media.ts

+ 1 - 1
src/directives/message_media.html

@@ -55,7 +55,7 @@
 
     <!-- Anim GIF -->
     <div class="animgif" ng-if="ctrl.downloaded && ctrl.isAnimGif">
-        <img ng-src="{{ ctrl.blobBuffer | bufferToUrl: 'image/gif'}}" />
+        <img ng-src="{{ ctrl.blobBufferUrl }}" />
     </div>
 
     <!-- Other file messages -->

+ 7 - 3
src/directives/message_media.ts

@@ -222,9 +222,13 @@ export default [
                                         break;
                                     case 'file':
                                         if (this.message.file.type === 'image/gif') {
-                                            // show inline
-                                            this.blobBuffer = blobInfo.buffer;
-                                            // hide thumbnail
+                                            // Show inline
+                                            this.blobBufferUrl = bufferToUrl(
+                                                blobInfo.buffer,
+                                                'image/gif',
+                                                logAdapter($log.warn, this.logTag),
+                                            );
+                                            // Hide thumbnail
                                             this.showThumbnail = false;
                                         } else {
                                             saveAs(new Blob([blobInfo.buffer]), blobInfo.filename);