Hi
This solution
// Resized to a size that most phones should support var resizedImage = e.media.imageAsResized(1024, 1024); // Set the image view with the resized image imageView.image = resizedImage;works fine for me. Previously I was having problem in some of the devices for capturing and showing image, but I have resolve that issue as mentioned above.
Here is my full code and problem.
var win = Titanium.UI.createWindow ({ backgroundColor : '#fff', layout : 'vertical' }); var recordButton = Titanium.UI.createButton ({ title : 'Image Capture', top : '10dp', zIndex : 2 }); win.add (recordButton); // Create a Button. var aButton = Ti.UI.createButton ({ title : 'test cam', top : "10dp", left : 2 }); aButton.addEventListener ('click', function () { // Create an ImageView. var anImageView1 = Ti.UI.createImageView ({ image : Ti.Utils.base64decode (strImageEncode), width : 280, height : 290, top : 30, right : 10 }); // Add to the parent view. win.add (anImageView1); }); // Add to the parent view. win.add (aButton); win.open (); var strImageEncode = ""; var anImageView = ""; recordButton.addEventListener ('click', function () { Ti.Media.showCamera ({ success : function (e) { if (e.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { alert ('Your photo was saved to the Photo Gallery' + JSON.stringify (e.media)); // Create an ImageView. //anImageView.image = e.media; anImageView = Ti.UI.createImageView ({ id: "image1", image : e.media.imageAsResized(1024, 1024), width : 280, height : 290, top : 30, left : 10 }); // Add to the parent view. win.add (anImageView); strImageEncode = Ti.Utils.base64encode (e.media); } }, cancel : function () { alert ("Cancel photo click"); }, error : function (error) { var message; if (error.code == Ti.Media.NO_CAMERA) { message = 'Device does not have video recording capabilities'; } else { message = 'Unexpected error: ' + error.code; } Ti.UI.createAlertDialog ({ title : 'Camera', message : message }).show (); }, //saveToPhotoGallery : true, allowEditing : true, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO] }); });After capturing image it shows me image correctly as i have resized it. but when I convert it to
Ti.Utils.base64encode (e.media) and store it in strImageEncode and then on click of aButton it does not show me image back.
It is not showing me image since i have used strImageEncode = Ti.Utils.base64encode (e.media);
I am using alloy framework.
Thanks in advance.