diff options
author | Emmanuel ROHEE <erohee@amdocs.com> | 2014-08-22 10:48:00 +0200 |
---|---|---|
committer | Emmanuel ROHEE <erohee@amdocs.com> | 2014-08-22 10:48:00 +0200 |
commit | 53f4fbd99a223a4321377ea670d1d19b669b6f4a (patch) | |
tree | 064cb113ff23a35471371a30ec002d3d47a3e008 /webclient/components/utilities/utilities-service.js | |
parent | Safari needs the img.onload event before actually working on the img (diff) | |
download | synapse-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 '')
-rw-r--r-- | webclient/components/utilities/utilities-service.js | 4 |
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) { |