CodeIgniter Forums
Batch Image Upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Batch Image Upload (/showthread.php?tid=13714)



Batch Image Upload - El Forum - 12-02-2008

[eluser]mck9235[/eluser]
I'm using CodeIgniter (1.7) to create the backend for a gallery. For uploads, I want to be able to upload about 10-20 1MB+ photos, resize them, and store there file paths in the database. All of this needs to be done without the server timing out.

I'd greatly appreciate any advice/solutions/tips for doing this -- I'm a bit stumped at the moment!


Batch Image Upload - El Forum - 12-02-2008

[eluser]JoostV[/eluser]
You need to use the Image Magick library for resizing. It's way more efficiemt than GD.

Furthermore you may need to set higher values for
* upload_max_filesize (so you can upload larger files than the default 2MB, careful with what you set here Smile)
* max_input_time
* memory_limit
* max_execution_time
* post_max_size (so your total post can be bigger than the default 8MB)

You do not need to alter php.ini for this. You can use ini_set().

max_input_time can be set using set_time_limit()


Batch Image Upload - El Forum - 12-03-2008

[eluser]darrenm[/eluser]
You may also want to look into Swf Upload

It's had a few issues dealing with Flash Player 10 and is not as elegant as it used to be, but it's still a great way to upload multiple files with progress indicators etc.

Quite a learning curve to get it integrated in an application but your users will thank you in the end. It will solve many of your timeout troubles as you're moving a lot of the heavy processing over to Ajax routines.

It does - eventually - integrate into CI nicely but you may have to solve some authentication problems as the Flash Player will initiate a new session when it connects.

That all sounds a bit negative doesn't it?! Didn't mean to. Once it's all working it makes a HUGE difference to your application.