-1

I am new to iphone programming. Can any body tell me that how to store image path in sqlite database,i now how to store image in database but i dont want to store image.I want to store only path of the image in photo gallery.

Please can any body tell me. Thanks

Anitha
  • 1
  • 7
  • Have you even tried anything yet? Simply asking us to code something for you won't suffice. – basvk Nov 09 '12 at 09:33

2 Answers2

0

Implement UIImagePicker delegate

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {    

    NSURL *imageURL = [info valueForKey:UIImagePickerControllerReferenceURL];

     //save the URL to database
}
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
  • Hi Thanks for replay.Acctually i got path of the image .now i want ot store that path in database.if i select image from gallery it has to store that image path in database.Can u please tell how to do this – Anitha Nov 15 '12 at 07:29
  • just convert the imageURL to Nsstring and save it to database. like NSString *myString = [imageURL absoluteString]; // save myString to db – Shamsudheen TK Nov 15 '12 at 07:46
  • the url will be like assets-library://asset/asset.JPG?id=1000000003&ext=JPG – Shamsudheen TK Nov 15 '12 at 07:47
  • if you want to display the image back using the saved url, just use ALAsset Library http://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone – Shamsudheen TK Nov 15 '12 at 07:48
  • hi iam directly storing path in database.now how can i get all store image path – Anitha Nov 15 '12 at 08:38
  • Hi i have store some image path in database and i retrieve that image from database after that i store all image path in array from database.now i want to display all images in thumbnail.How can i do that.Please can any body help me – Anitha Nov 16 '12 at 06:56
  • see my answer her http://stackoverflow.com/questions/11322289/how-to-show-the-specific-image-from-photolibrary/11322770#11322770 – Shamsudheen TK Nov 16 '12 at 10:12
  • and one more thing i have more than 20 images path are there in array. i want to display all images how can i display all images. – Anitha Nov 16 '12 at 11:03
  • Thank u so much its working and one more thing i have more than 20 images path are there in array. i want to display all images how can i display all images. – Anitha Nov 17 '12 at 04:16
  • use a for loop and iterate the urls and display the images – Shamsudheen TK Nov 19 '12 at 04:23
0

if you use fmdb as SQLite wrapper, then it's a simply insert like: [db executeUpdate:@"INSERT INTO myTable (name) VALUES (?)", YOUR_IMAGE_PATH]. Otherwise if plain SQLite, you may refer to this question

Community
  • 1
  • 1
BabyPanda
  • 1,562
  • 12
  • 18
  • Hi i have store some image path in database and i retrieve that image from database after that i store all image path in array from database.now i want to display all images in thumbnail.How can i do that.Please can any body help me – Anitha Nov 16 '12 at 06:48
  • what's your question then? How to get all the image paths from database or how to display an image with its path? – BabyPanda Nov 16 '12 at 07:07
  • i have stored some images path in database.now i want to display that stored images.how can i do that – Anitha Nov 16 '12 at 07:13
  • you need to be more specific about the question – BabyPanda Nov 16 '12 at 07:14
  • Acctually i stored some images path in sqlitedatabase and also i retrieve that images paths also in console which i have stored in database.Now i have images path now i want to display all this images in next view. – Anitha Nov 16 '12 at 07:19
  • "assets-library://asset/asset.JPG?id=D714F0AA-AF90-4D1C-947B-0A55EEEC0CEA&ext=JPG", "assets-library://asset/asset.JPG?id=60B4821E-2AAA-4C33-97E1-3320DB9C4E77&ext=JPG", "assets-library://asset/asset.JPG?id=CF461579-BB37-45F0-9A2E-1EF3BAAEB063&ext=JPG", – Anitha Nov 16 '12 at 07:49
  • iam getting path like this. i tried but its not display image – Anitha Nov 16 '12 at 07:49
  • If asset path, then you may refer to [this](http://stackoverflow.com/questions/7777282/how-to-get-image-path-from-photo-library-and-how-to-retrieve-the-image-from-phot) – BabyPanda Nov 16 '12 at 07:50
  • and i store these path in array.inside the array some many paths r there. now i want to display all this path images. how can i do . – Anitha Nov 16 '12 at 07:50
  • Either edit your question or move this discussion to chat. I can't just answer all the questions in comment... – BabyPanda Nov 16 '12 at 07:59