Reproduce
1.Add following simple code to classic app.
2.Run the app on iOS device.
3.Click button to pick one of your image, then display it. You will see the image is cut in the bottom.
var win = Ti.UI.createWindow({
backgroundColor:"white"
});
var button = Ti.UI.createButton({
title : 'Open Gallery',
width : 100,
height : 50,
top : 20
});
var imageView = Ti.UI.createImageView({
top : 100
});
button.addEventListener('click', function(){
Ti.Media.openPhotoGallery({
success: function(event) {
Ti.API.debug(event.mediaType);
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
var obj = calculateAspectRatioFit(event.media.width, event.media.height, 700, 700);
var resizedBlob = event.media.imageAsResized(obj.width, obj.height);
resizedBlob.imageAsCompressed(0.7);
imageView.image = resizedBlob;
win.add(imageView);
}
},
cancel: function() {},
error: function(e) {
Ti.API.error(e.code);
},
});
});
win.add(button);
win.open()
function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) {
var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);
return {
width : srcWidth * ratio,
height : srcHeight * ratio
};
}
Note.
Seems only happened to iOS.
Duplicate to TIMOB-25336