Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone ($4.99)

dotnetIQ ($4.99)

Your First iPhone App ($1.99)

iPocket Tools 9 in 1 ($0.99)

Catch-Me (Free)

Alien Strike ($0.99)

Historic Olympic Medal-Table ($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 06-29-2009, 11:45 AM   #1 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 25
Default Image capture, resize, ftp upload - performance

Hello fellow coders,

Would appreciate some advice on how best to do the following with the least performance issues.

I have a view where I have 8 custom buttons - each one, when clicked, opens up the camera to take a picture, replace the custom button image with the image from the camera. The user can do this for all the buttons. When he's done, the images may need to be resized, and then uploaded to an ftp server. Then he can go back, pick another item, and do the same again.

I've got the bare bones of this working with the camera image, and ftp upload working. What I'm trying to figure out is what the best approach is to store these images for later upload without hogging up the memory. I understand they will need to be done in a background process.

I thought of writing them to file, and keeping a log of the file names in an array which I can enumerate later and do a batch upload. Alternatively, once the 8 images are captured, do the upload so that there is no large backlog.

Before the images are uploaded, they may need to be resized depending on the user settings. So that is another overhead.

Any insight and advice on how best to approach this would be greatly appreciated.

Thanks.
ir001 is offline   Reply With Quote
Old 06-30-2009, 03:17 AM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 25
Default

Anyone - any ideas?
ir001 is offline   Reply With Quote
Old 06-30-2009, 03:32 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 39
Default

I have a quite large gps navigation app and during track recording user is allowed to take a photo. So, once I've got an image I store it in sqlite database (or file, doesn't matter). Also, there is NSOperation continuously running in background, so whenever it discovered not uploaded photo it sends HTTP POST request with this photo. When it has done with upload it checks for a new one, etc. If no photos are in 'queue' it pauses NSThread (background one) for some time and then checks again.
Artem is offline   Reply With Quote
Old 06-30-2009, 04:35 AM   #4 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 25
Default

Hey,

Thanks for the response. Have you noticed any performance issues with the NSThread running in the background and polling for the file? Or even the NSOperation running?

I don't need to keep a copy of the image on disk, but I guess I could save it out to disk, and then once uploaded, delete it. It does sound better (and more optimised) than storing them in memory as the number of images could grow.
ir001 is offline   Reply With Quote
Old 06-30-2009, 06:03 AM   #5 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 39
Default

Yeah, I noticed that this is the only way it works without serious performance issues

Quote:
I don't need to keep a copy of the image on disk, but I guess I could save it out to disk, and then once uploaded, delete it. It does sound better (and more optimised) than storing them in memory as the number of images could grow.
Actually, no. You need to have that copy on disk because iPhone cannot keep in memory so much images. Two full-sized 2MPix photos is enough, 3 is a pain - iPhone will pelt you with didReceiveMemoryWarning trying to get some memory.
Artem is offline   Reply With Quote
Old 06-30-2009, 06:20 AM   #6 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 25
Default

Quote:
Originally Posted by Artem View Post
Yeah, I noticed that this is the only way it works without serious performance issues


Actually, no. You need to have that copy on disk because iPhone cannot keep in memory so much images. Two full-sized 2MPix photos is enough, 3 is a pain - iPhone will pelt you with didReceiveMemoryWarning trying to get some memory.
Fair point! I will try this route out and see what happens! Thanks for the insight and advice! Much appreciated.
ir001 is offline   Reply With Quote
Old 10-14-2009, 03:18 AM   #7 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 1
Default change button image

hi,
can u send me the snippet how you have change the custom button image.I am trying a lot no luck yet.
Sultankeshwar is offline   Reply With Quote
Reply

Bookmarks

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
» Stats
Members: 21,492
Threads: 35,775
Posts: 156,707
Top Poster: smasher (2,448)
Welcome to our newest member, gate491
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:26 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0