Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-28-2010, 08:04 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 4
rollinggem is on a distinguished road
Default Store images in sqlite or folder

Hi,

I am working on a recipe based app. Here on clicking a recipe name I am displaying a detailed view with things like ingredient,skill, time etc and instruction link. On clicking the instruction I need to show a series of images.

My question is what would be the right way to store these images - in sqlite itself or in folder and the name of folder in the db.

I plan to store the data for detailed view in sqlite; assuming there are say 50 recipes is it wise to read all the recipes data at app load time or only the particular recipe data on row selection. I am little bit confused weather extra sql call would make the app slower in second case.

Thanks for all the help.

regards,
Rols

edit: the app is read-only, user won't be adding new entries.

Last edited by rollinggem; 11-28-2010 at 08:07 AM. Reason: adding extra information
rollinggem is offline   Reply With Quote
Old 11-28-2010, 09:37 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by rollinggem View Post
Hi,

I am working on a recipe based app. Here on clicking a recipe name I am displaying a detailed view with things like ingredient,skill, time etc and instruction link. On clicking the instruction I need to show a series of images.

My question is what would be the right way to store these images - in sqlite itself or in folder and the name of folder in the db.

I plan to store the data for detailed view in sqlite; assuming there are say 50 recipes is it wise to read all the recipes data at app load time or only the particular recipe data on row selection. I am little bit confused weather extra sql call would make the app slower in second case.

Thanks for all the help.

regards,
Rols

edit: the app is read-only, user won't be adding new entries.

Everything I've read advises against storing big blocks of binary data in SQLite. It slows things down. Better to store a path in your database, and save the images to your documents directory. Then use the path to load the images when you need them. That's what I've done, and it works well.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 11-28-2010, 11:21 AM   #3 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 107
JDave is on a distinguished road
Default

For portability to other systems (non-iOS...), consider keeping in all in a database. I have a 20+ MB sqlite3 READ-ONLY SQLite3 database with over 500 images, that are accessed with bulk queries about 20-40 images at a time. All images as stored as BLOBs... I initially started it as holding 10-20 images, and later scaled it up to it's current size, and never ran into 'new' performance issues. I do run into problems loading multiple (10+) images at a time, mainly on an iPhone 3G (iPad and iPhone 4 have some lag for large query-retrieve but there are tricks to get around that...), but if you are querying 1 or 2 images at a time, sql will be a really good way to go - still not as fast as keeping in your resource folder though... I do not know how performance will change if you make it read-write...

As an aside, I use the same SQL db to hold tableViewCell images, and they load without lag on a 3G (using the standard 'recycled' tableview cells...).
JDave is offline   Reply With Quote
Old 12-01-2010, 09:25 AM   #4 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 4
rollinggem is on a distinguished road
Default

Hi,
I really appreciate the help I got here.

@Duncan: thanks a lot for quick reply.
@JDave: thanks for sharing the db information, your numbers gave me good idea of what to expect from the sqlite db. My use case is very much in line with what you mentioned, around 500 images with loading of 15-20 images at a time. For now I am just going to put them in file system mainly because I would prefer not to have a lag.
rollinggem is offline   Reply With Quote
Reply

Bookmarks

Tags
data, image, sqlite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 376
7 members and 369 guests
daudrizek, HemiMG, Kirkout, MarkC, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,665
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, daudrizek
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0