NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP multiple image upload using a zip file

David Krings ramons at gmx.net
Tue Jan 1 13:36:44 EST 2008


Jonathan Wagener wrote:
>  Hi, i am trying to add a function my gallery app that i builkt in php/mysql to allow people to upload a zip file of JPG images and the system would extract the JPGs, rename them, reference them in MySQL, create thumbnails, and then move the images to their directories.
> 
> I have seen this function in all the galleries that i have looked at and have googled the problem but i have not found a good answer. I have been struggling with this issue for two days now.
> 
> Jonathan Wagener

Hi!

I added this to my piviviewer app (Picture & Video Viewer) and it works great. 
I call the feature 'turboload' as I managed to jam 800 jpegs straight from my 
camera into my system within a matter of minutes. I store the images with a 
dummy name so that I can later query for it and add the description and search 
tags whenever I like. I attached the two scripts that show the upload form 
allowing for both direct upload or using the cURL library to obtain the file 
from somewhere else (for example the FTP server that is on the web server, so 
one can first upload via FTP and then load from the same box, which makes 
things much quicker within the app). The zip library is then used to unzip the 
files and add them to the system. I also use exif to read out the date stamp 
as I let my system arrange the uploaded images in a directory structure that 
is based on year and month. That way I have at least some structure that I can 
outside of the app.
In case you wonder, I made my app to be language aware so that some of the 
queries go to language dependent tables. The current user language and some of 
the basic file paths are stored in $_SESSION, so you will find several 
references to $_SESSION. You can just ignore all that stuff and pick out what 
you need. My scripts are extensively commented, which helps me a lot. I first 
write the comment for the next step to take and then write the code for it. 
Oh, and 80% of these scripts are from NYPHP anyway, so if you find it useful, 
thank the good helpers on this list. The remaining 20% are the comments, hehe.

David

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: turboloadpics.php
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080101/4e57bdc5/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tlsubmit.php
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080101/4e57bdc5/attachment-0001.ksh>


More information about the talk mailing list