Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.
This is how I do it:
var image = require('image');
Ti.Media.showCamera({
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
success: function (e) {
myImageView.image = image.crop(e.media, myImageView.rect);
}
});
Take a look at the next image.js file to learn how it works.
blob: TheTi.Blobcontaining the image.options: Either anobject(or Dimension) containing the targetwidthandheightand the other options listed below, or a Number representing only thewidth.height: The targetheight.
width: See above.height: See above.pixels: Set toFALSEto disable converting target dimensions to actual pixels needed for either Retina or Android variable DPI.fix: Set toFALSEto disable the workaround for bug TIMOB-4865.
Is there a 'simple' way to use this with remote images (URLs) or do I need to download each image first and then load it into a blob?
EDIT:
I was able to get it working doing the following: