summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-08-22 10:48:00 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-08-22 10:48:00 +0200
commit53f4fbd99a223a4321377ea670d1d19b669b6f4a (patch)
tree064cb113ff23a35471371a30ec002d3d47a3e008 /webclient/components
parentSafari needs the img.onload event before actually working on the img (diff)
downloadsynapse-53f4fbd99a223a4321377ea670d1d19b669b6f4a.tar.xz
resizeImage: generate an image in the format of the original image. (Tested with tranparent PNG, transparent GIF, BMP, JPEG)
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/utilities/utilities-service.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/webclient/components/utilities/utilities-service.js b/webclient/components/utilities/utilities-service.js
index 5e9f707221..3df2f04458 100644
--- a/webclient/components/utilities/utilities-service.js
+++ b/webclient/components/utilities/utilities-service.js
@@ -103,7 +103,9 @@ angular.module('mUtilities', [])
                 var ctx = canvas.getContext("2d");
                 ctx.drawImage(img, 0, 0, width, height);
 
-                var dataUrl = canvas.toDataURL("image/jpeg", 0.7); 
+                // Extract image data in the same format as the original one.
+                // The 0.7 compression value will work with formats that supports it like JPEG.
+                var dataUrl = canvas.toDataURL(imageFile.type, 0.7); 
                 deferred.resolve(self.dataURItoBlob(dataUrl));
             };
             img.onerror = function(e) {