Upload Photo(s) Then Resize

Upload Photo(s) Then Resize
Upload Photo(s) then resize

I am looking for a script written in PHP to accomplish the following.

This script will be executed in a membership area.

I have a script working right now, just looking to improve it.

1. User clicks on record/item. There is a link on the page to upload new photos.
We allow up to 7 photos per item and the size to display is fixed. 450 px wide x 350 px high.

What I need:
1. A form that displays 7 Select File Fields
2. When all photos to upload are selected and the users hits the upload button:
a. Error checking is preformed to make sure it is a valid jpg, gif or png. If photo is not a valid jpg, gif, or png, the same form is refreshed indicating right next to photo line item or items(s) that are invalid.
b. Checks that the file size does not exceed 15 Meg (I do want the ability to change this as a variable). If the file size is larger than 15 Meg, page will refresh indicating which item or items exceed this limit.
c. If above checks out, the original image is given the name of the item (which comes from mysql query [NAME]) it is also assigned a year number (which comes from mysql query [YEAR] and then it is given an incremental count number.

NAMING FILE FORMAT: [NAME]_[YEAR]_[Auto increment].jpg

The original File will be stored in ORIGINAL directory.

Then the script will figure out how to resize the image to fit into 450 px wide x 350 px high (image cannot exceed these parameters). A Black background color is assigned for the void space.

Once this image is created, it is given the same name as the original file and stored in IMAGE directory.

After it is written to IMAGE directory, it creates two thumbnails (same per portion) 220 px wide x 171 pw high given same file name as above stored in MED directory and then creates the final image 75 px wide x 58 px high, given same name as above and stored in SM directory.

All compression should be based on quality (we need image to display well) not compression.

d. While the above is happening, the page opens up an indicator bar showing the progress until all is completed.

If uploading multiple files, the indicator bar will display for 1st photo, and if all works OK and is completed, displays photo 1 uploaded successfully with thumbnail photo next to it, then moves on to file 2, displays indicator bar and loops until completed.

Leave a Reply

Your email address will not be published. Required fields are marked *