3

I have a large amount of images that correspond to records in a sqlite db. where should I store them? I have 3 versions of the same image - large, med, thumb sizes. (I don't want to store them in the db table, but reference them instead from each record)

all the images have the same name - each small, med and large image files would all be called "1.jpg" for record 1 in the sqlite table etc... this is mainly because I'm using an image batch resizing program that retains the same file name and creates a new folder.

thanks for any help.

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
hanumanDev
  • 6,592
  • 11
  • 82
  • 146

1 Answers1

2

For my cached images, I stored them in TMP folder, you can access using NSTemporaryDirectory.

I don't know if it is good for your cases or if it is good in general but it works quite well

vodkhang
  • 18,639
  • 11
  • 76
  • 110
  • 1
    That works except if you actually want to keep them around indefinitely. The temp folder can be deleted by the OS at a whim. Hence the temp part. – Kalle Aug 28 '10 at 16:55
  • I have 500+ records in an sqlite table and need to have images (thumb, med, large) associated w/ each record. so, i have to figure out where to store them. – hanumanDev Aug 28 '10 at 17:13
  • @hanumandev: so, you want to store it forever, right? I am not sure but I think you should only keep some references on mobile side and most data on server side. Then, after images are deleted by OS, you can still loads from server? – vodkhang Aug 28 '10 at 17:22
  • yes, store them forever w/ the app. I was thinking that if they are stored on a server then the user won't have access to them if they loose their network connection. also there would be a delay every time a new image downloads. – hanumanDev Aug 28 '10 at 18:31
  • To be honest, I don't have a perfect solution for you. I think that a quite good solution is like I talked, keep them in the tmp directory and then expect (sorry that it is not sure) the OS does not delete it (which is not regularly). If they delete it, then you may need to download it again from server side – vodkhang Aug 29 '10 at 07:15
  • I am also trying to ask a new question here http://stackoverflow.com/questions/3593900/iphone-storage-in-tmp-directory – vodkhang Aug 29 '10 at 07:21
  • You may try with the cache directory according to the new answer to my questions – vodkhang Aug 29 '10 at 08:07
  • 1
    so, – Marcus S. Zarra said that "To be backed up and not deleted, it needs to be in the documents directory." that makes sense. that's I've I'm doing. it will end up being 100mb of images. – hanumanDev Aug 31 '10 at 05:52
  • yeah, I think 100 mb of images is quite a lot if you store in some weak iphone with 8gb. But, you may try – vodkhang Aug 31 '10 at 06:35