Storing images in the file system and master data

I am currently working on an iOS application that allows the user to add images from their photo library to the application. I store these images in the device file system and access them when I need them (when they are in the UIScrollView, I could access them quite often)

I just wanted to express some opinions on this approach. Should I stay with the file system method or would it be useful to save these images to me in CoreData.

Any suggestions on this subject would be greatly appreciated.

Thanks.

+6
ios core-data uiimage storage
source share
3 answers

I do not think that Core Data was really designed to store this type of data. This would be the moral equivalent of storing image data in a SQL / relational database, which is also not ideal.

I have a similar situation where I have a bunch of images stored in a hard target location (my list of images never changes, so I just include them all in the application package) with a Core Data repository containing a lot of metadata about the image. All I keep in the main data of the image itself is the file name, and then tear out the full path to the file at runtime when it is time to see the image. I have no problem with delay or delays.

Despite the fact that I do not display the image in UIScrollView, I still think that you have little problem getting an array of image information from the master data store and creating a full path to the file on the fly, since the cells are generated since then, it's just strings , and the code for creating UIImage is very compact. This is either to generate the same array of information, and then compile the array of image paths before any cells are generated, for example, when UIScrollView is about to appear.

+5
source share

You should use the file system method for anything more than a thumbnail.

On the one hand, if you are storing in Core Data, you must save it, either data or a transformable attribute. In any case, you have an extra step to convert to an image. If you are storing a file, you can simply use UIImage to download it directly.

The main problem, however, is the use of memory; a damaged image will not be cleared from memory like UIImage.

Update 2012-9-20: This answer is deprecated. Core Data no has its own system for storing large pieces of data, such as images in external files.

+3
source share

I think putting them in the main data will be slow. The file system will be much faster.

0
source share

All Articles