So I currently have a window with a view (id="newPhoto") in which I put an image from a previous step. Onto this newPhoto-view I position a new view (id="content") via css with an icon and some text on it. Then I want to save the parent view with the image and the icon and text on it as a new image to the photoGallery. What would be the easiest way? To put all in one view and save the new view, or to screenshot the desired part and save it? Cannot make this to work :(
my filterWindow.xml file:
<Alloy>
<Window id="filterWindow">
<View id="finalImage" />
<View id="selectedPhoto" />
<View id="counter">
<ImageView id="weatherIcon" />
<Label id="label" />
</View>
<Button id="filterAndSaveBtn" onClick="filterAndSave">Filter</Button>
</Window>
</Alloy>
My filterWindow.js:
var photo = Alloy.createController('photo').getView();
$.selectedPhoto.add(photo);
$.selectedPhoto.width = appWidth;
$.selectedPhoto.height = appWidth;
$.label.text = "Some text";
function filterAndSave(e) {
var blob = $.finalImage.toBlob();
Ti.Media.saveToPhotoGallery(blob,{
success: function(e){
alert('Saved image to gallery');
},
error: function(e){
alert("Error trying to save the image.");
}
});
}
Thanks in advance for having a look at this one!