I tried to use ImageFactory.imageAsResized for resizing images.
but some times for some images it returns null.
I want to know is there any specification for images that we want to upload.???
given code may show my problem
var saveImageData = ImageFactory.imageAsResized(image, {
width : 480,
height : 360
});
if (saveImageData !== null) {
var toast = Titanium.UI.createNotification({
duration : 1000,
message : "save true "+saveImageData
});
toast.show();
} else{
var toast = Titanium.UI.createNotification({
duration : 1000,
message : "Problem in image resizing "+saveImageData
});
toast.show();
};
in this above code some times i got null.whats is the reason for that?
Is it based on image size that we uploading?
if it is correct.. then for same size image its shows some times null,some times not null. whats is this problem.i cant able to handle this ImageFactory functionality.
please give any solution.because i stucked with this problem on my app.
Thanks all.
First, check if image is not null. Secondly instead of using the ImageFactory use the builtin method. i.e Titanium.Blob.imageAsResized
I assume that "image" variable has the blod data. so you can just call image.imageAsResized(480,360);
Hope this helps