Uploading file via form with email validation for gallery

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
millo_2k
Forum Newbie
Posts: 4
Joined: Tue Sep 28, 2010 10:20 am

Uploading file via form with email validation for gallery

Post by millo_2k »

Hi guys,

really need some help with this as I cant seem to get my head round it. I have been asked by a local charity to create a website for a competition. It was supposed to be a simple thing which no longer is!... Basically, they want the user(who isnt registered or logged in) to be able to upload a photo which eventually will be displayed on a gallery but they want to be able to check the photo first. I cant really find a packaged gallery that fulfills those things so was thinking of building a file upload form, which sends the file to admins email which they then confirm and the file is uploaded to the server which the gallery then displays. Is this a waste of time idea? I cant think of any other way to do it? Can somebody help with this?!!!

Thanks everyone
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Uploading file via form with email validation for galler

Post by Jonah Bron »

If you can't find one that fits your needs, you can modify one. Or, you might look into just making one. Google "php image gallery tutorial".
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Uploading file via form with email validation for galler

Post by twinedev »

Instead of e-mailing them the actual photo (could be rather large with some cameras out there these days), I would create a directory to hold the image until previewed by the admin.

Pretty much, take whatever code would normally place the uploaded image where you wanted it for the gallery, and instead have it go to a directory called something like "staging", that is protected to require you to be logged in to view the directory contents. Send the admin a link to the image, and a second link to aprove and/or remove the photo.

If it is approved, then move the image to the final location (again, make sure that you have to be logged in as admin to call this script)

If you do go the route of e-mailing it to them anyhow, again, put a directory somewhere in the admin to hold it, then use (if you have it available) Image Magik to resize the image down to something more manageable to e-mail to the admin.

Code: Select all

system("convert  /path/to/photo.jpg -thumbnail '200x200>'  /path/to/photo/to/email.jpg");
Then if they upload a 2000x1000 4 meg file from their camera, the e-mail will contain a lot smaller 200x200 (at most) image, which should be suitable for approving or not.

-Greg
millo_2k
Forum Newbie
Posts: 4
Joined: Tue Sep 28, 2010 10:20 am

Re: Uploading file via form with email validation for galler

Post by millo_2k »

Thats a great idea, do you know any php script to do that?

Thanks guys
Post Reply