class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Salut! Thank you very much for the wonderful Upload Class!
I'm currently using Upload Class 0.25 RC1 for multiple files uploading, but having some problems.
Each file uploaded will first be sent to create thumbnail, then again to resize uploaded image larger than 640 px to 640 px.
Sample #1: with $handle->image_crop = '0 0 -12px 0'; thumb1.jpg1.jpg
You can see file uploaded in Sample #1 the larger image has a problem with the pure black part being converted into white. But Sample #2 with that image_crop turned off will not have the problem. I'm using image_crop to add a black space for me to add in watermark.png.
Sample #2: without $handle->image_crop = '0 0 -12px 0'; thumb2.jpg2.jpg
After the uploading process completed, a thumbnails page of images users has just uploaded will be shown to user, but the thumbnail file doesn't exist yet... I'm thinking of adding a sleep() function waiting for thumbnails ready, or do you have a better solution?
I've tested this on both local and live servers, both giving the same problems. Local: Apache/1.3.33 (Darwin) PHP/5.2.2 Live: Apache/1.3.37 (Unix) PHP Version 5.2.3
The error occurs because when the class crops, with negative margins, it creates up extra space, which by default is black. PHP image_file() function fills that area, but spills on the picture itself if it contains a contiguous black area.
To solve it, change the following into:
// fill in from the edge of the negative margin
if ($ct < 0) imagefill($tmp, round($this->image_dst_x / 2), 1, $fill);
if ($cr < 0) imagefill($tmp, $this->image_dst_x - 1, round($this->image_dst_y / 2), $fill);
if ($cb < 0) imagefill($tmp, round($this->image_dst_x / 2), $this->image_dst_y - 1, $fill);
if ($cl < 0) imagefill($tmp, 1, round($this->image_dst_y / 2), $fill);
As for the images not being created quickly enough, it is strange. When the class dumps the image, it does so, then only the script continues. So when the page with the link to the image is sent to the browser, the image has been indeed created. Maybe your live server uses a filer, and the files need a little bit of time to synchronise.
I'm currently using Upload Class 0.25 RC1 for multiple files uploading, but having some problems.
Each file uploaded will first be sent to create thumbnail, then again to resize uploaded image larger than 640 px to 640 px.
Sample #1: with $handle->image_crop = '0 0 -12px 0';
thumb1.jpg 1.jpg
You can see file uploaded in Sample #1 the larger image has a problem with the pure black part being converted into white. But Sample #2 with that image_crop turned off will not have the problem. I'm using image_crop to add a black space for me to add in watermark.png.
Sample #2: without $handle->image_crop = '0 0 -12px 0';
thumb2.jpg 2.jpg
After the uploading process completed, a thumbnails page of images users has just uploaded will be shown to user, but the thumbnail file doesn't exist yet... I'm thinking of adding a sleep() function waiting for thumbnails ready, or do you have a better solution?
I've tested this on both local and live servers, both giving the same problems.
Local: Apache/1.3.33 (Darwin) PHP/5.2.2
Live: Apache/1.3.37 (Unix) PHP Version 5.2.3
Merci beaucoup!
WoofWoof75
The error occurs because when the class crops, with negative margins, it creates up extra space, which by default is black. PHP image_file() function fills that area, but spills on the picture itself if it contains a contiguous black area.
To solve it, change the following into:
to
This will be added in the next release.
As for the images not being created quickly enough, it is strange. When the class dumps the image, it does so, then only the script continues. So when the page with the link to the image is sent to the browser, the image has been indeed created. Maybe your live server uses a filer, and the files need a little bit of time to synchronise.
(edit: implemented a better fix)
Thank you for the fix.
By the way, regarding the "thumbnails" not showing... it occurs to both local testing server and the live server.
Maybe will just use the sleep() function then.
Merci beaucoup pour le fabuleux upload script! :-)
WoofWoof