 |
 |
|
 |
06-29-2009, 11:45 AM
|
#1 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 25
|
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.
|
|
|
06-30-2009, 03:17 AM
|
#2 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 25
|
Anyone - any ideas?
|
|
|
06-30-2009, 03:32 AM
|
#3 (permalink)
|
|
Registered Member
Join Date: Jun 2009
Posts: 39
|
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.
|
|
|
06-30-2009, 04:35 AM
|
#4 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 25
|
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.
|
|
|
06-30-2009, 06:03 AM
|
#5 (permalink)
|
|
Registered Member
Join Date: Jun 2009
Posts: 39
|
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.
|
|
|
06-30-2009, 06:20 AM
|
#6 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 25
|
Quote:
Originally Posted by Artem
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.
|
|
|
10-14-2009, 03:18 AM
|
#7 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 1
|
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.
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 468 |
| 37 members and 431 guests |
| al31, alexanderlonsky, AXP, bartender, BustinStones, CanadaDev, CHV, dany88, davidloew, delphipgmr, DorkyMohr, dre, gate491, ggalante, HUngable, iseff, issya, japaternoster, jorgmart, KennyChong, kev12345, kvoyt, learnSomething, listingboat, lukeca, macstar, MacSteve85, masc2279, mebarron, Mr Jack, RegularKid, siemens, Slecorne, Stephane.tamis, supudo, wheli, zmarco |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,492
Threads: 35,775
Posts: 156,707
Top Poster: smasher (2,448)
|
| Welcome to our newest member, gate491 |
|