I'm attempting to create a Snapost-like app where a user can upload and image & text to a web service.
Unlike Snapost though, I'm creating different views and using the cooler 'slide' animation. My problem is passing the event.image created by the camera/photo gallery to a new view. I've tried creating a global var in the app.js file and storing the image in a property all to no avail.
I feel that the property approach is the better route, but I only see the ability to store strings not objects. Anyone have any idea how I could do this?
Actually I thought of something like this:
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'tmp.jpg'); f.write(this.responseData); Titanium.App.Properties.setString('myTmpImage', f.nativePath);
You could write the image into a file and pass the path if this is an option for you.
Then delete the file when done? If you don't mind, what would the code look like to do such a thing?
I don't mind but I am not at my workstation. But have a look into the KitchenSink examples, xhr_remote_file.js or similar, you should find there the code your looking for.
So I've reviewed the Kitchen Sink examples, and they allow you to point to a file that you have in your file stack and save it to the photo gallery, but they don't have an example where you can get the path to the image saved on the phone's filesystem.
Maybe the best solution is to just launch the camera/photo gallery on the page that I'd like to use it….that solves all of this doesn't it. I guess I'll just do that.
Anyone with a better idea, please let me know.
You're solution worked! Thanks!