Retreiving an image from photo gallery by filename?

You must Login before you can answer or comment on any questions.

All,

I am writing an iPhone and Android app where I want the user to either be able to take a photo using the camera or select from the image gallery and save that photo in a database record. I have seen that it is not advised that we store the blob in the database, so I would rather store the image name or ID. I am planning on storing the nativePath of the image in the database, but is there a way to retrieve the image from the image gallery by name or other ID when the record is retrieved from the database so I can assign it to the imageView? Do I need to save the selected image to the FileSystem so I can retrieve it later? There shouldn't be more than 10 database records in the app, so it is not the end of the world if I have to do that, but I would prefer not to if I can avoid it.

  • Titanium Studio, build: 2.1.1.201207271312
  • Titanium Mobile SDK 2.1.1
  • iOS SDK 5.0
  • Android API 4.0.3

Thanks, B

— asked 10 months ago by Bruce Parr
0 Comments

1 Answer

Accepted Answer

event.media variable in your code would give you the image, if you want to get the image after its been saved to the photo gallery, you have 2 options... Save the file manually yourself, to your apps documents, or download a module like this that will let you access the images in the photo gallery.

— answered 10 months ago by Ashutosh Chaturvedi
answer permalink
1 Comment
  • Went with saving the file locally using a GUID as the filename when the image is selected from the gallery or taken by the camera. Then I just store the GUID. Thanks for the info though!

    — commented 10 months ago by Bruce Parr

Your Answer

This question has been locked and cannot accept new answers.