[AC-2769] sequential use of openPhotoGallery with imageview.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-04-10T22:27:20.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | image, imageview |
Reporter | marzpet vardanyan |
Assignee | Junaid Younus |
Created | 2012-03-11T03:45:48.000+0000 |
Updated | 2016-03-08T07:47:40.000+0000 |
Description
I was trying to let the user select an image from the gallery then show it in an imageview befor sending it over to my server.
the window that contains the imageview has a back button(confirmationWindow.close()) to cancel and start over.
the first time is no problem the image loads perfectly but then it starts to get buggy and sometimes the image isn't visible.
is this a bug? or am I doing something wrong?
Titanium.Media.openPhotoGallery({
success: processImage,
cancel: function(){return false;},
error: imageFailed,
});
function processImage(image){
//remove previously added image
var children = imageHolder.children.slice(0);
for (var i = 0; i < children.length; ++i) {
imageHolder.remove(children[i]);
}
// place our picture into our window
imageHolder.add(Ti.UI.createImageView({
transform: Ti.UI.create2DMatrix().scale(1),
center: {x: '50%', y: '50%'},
image: image.media,
}));
imageviewer.open();
//imageHolder.add(webview);
Titanium.App.imageBlob = image.media;
/*
* rotate image
*/
var cropRect = image.cropRect;
var height = cropRect.height;
var width = cropRect.width;
alert("base64=" + image.media.toString());
if(height> width){
//imageView.transform = Titanium.UI.create2DMatrix({rotate: -90,duration: 1,});
}
return false;
}
Hi Marzpet - I've not been able to reproduce the issue starting from your sample code. This is how I adapted your sample code:http://pastie.org/3712949 It would be possible for you to post a whole runnable portion of code reproducing your problem? I'm missing a few objects (imageviewer for example). Thanks
Hey Marzpet, I don't seem to be able to reproduce this issue with your given code either. Any chance you could attach a working sample project that reproduces the problem? This will help us fix this bug asap. Thank you! Junaid
I'm also having similar issues. When calling openPhotoGallery and selecting a picture, it works only two times, then freeze on the Move and Scale view. Code: var pictureDialog = Ti.UI.createOptionDialog({ cancel: 2, options: ['Gallery', 'Camera', 'Cancel'], title: 'Select' }); pictureMoldura.addEventListener('click', function(e) { pictureDialog.show(); pictureDialog.addEventListener('click', function(e) { switch(e.index) { case 0: Titanium.Media.openPhotoGallery( { success:function(event) { }, error:function(error) { Ti.API.debug(error); }, allowEditing:true, mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO] }); break; ...
It looks like the error is occurring when using an OptionDialog to call the photoGallery. Recreating the optionDialog every time seems to solve the problem: button.addEventListener('click', editPicture); function editPicture(e) { var pictureDialog = null; var pictureDialog = Ti.UI.createOptionDialog({ cancel: 2, options: ['Gallery', 'Camera', 'Calcel'], title: 'Select' }); pictureDialog.addEventListener('click', function(e) { switch(e.index) { case 0: Titanium.Media.openPhotoGallery( ... break; case 1: Titanium.Media.showCamera( ... break; } }); }); pictureDialog.show(); }