[AC-4782] Ti.Blob imageAsCompressed function does not exist
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Invalid |
Resolution Date | 2017-02-08T21:53:47.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | blob, image |
Reporter | Nicholas Thurston |
Assignee | Shak Hossain |
Created | 2017-02-08T21:11:29.000+0000 |
Updated | 2017-02-08T21:53:51.000+0000 |
Description
The Ti.Blob imageAsCompressed function does not appear to exist. I get "undefined" is not a function when trying to run it.
Some code:
compressImage: function(original) {
var image = this.resizeImage(original);
return image.imageAsCompressed(.75);
},
resizeImage: function(original) {
if (original.width < maxWidth && original.height < maxHeight) {
return original;
}
var aspectRatio = original.width / original.height;
if (original.width <= original.height) {
return original.imageAsResized(aspectRatio * maxHeight, maxHeight);
}
return original.imageAsResized(maxWidth, maxWidth / aspectRatio);
},
The original is response data from an http call. Note that the imageAsResized works fine. Since that should be returning a blob I would expect the imageAsCompressed function to work as well. I have been using Ti ImageFactory which does work, but wanted to see if the SDK function would be more efficient.
Attachments
File | Date | Size |
---|---|---|
Simulator Screen Shot Feb 8, 2017, 4.04.56 PM.png | 2017-02-08T21:05:07.000+0000 | 95834 |
It's will be available in SDK 6.1.0 and later: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Blob-method-imageAsCompressed