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.
I had a problem with the class when I enabled fileinfo, until I updated the class which fixed it. Now the images won't resize. Below is my code:
$image = new Upload($_FILES['uploadedfile']);
if ($image->uploaded) {
// save uploaded image with a new name
$image->file_new_name_body = 'test_main';
$image->image_convert = png;
$image->image_x = '100';
$image->image_y = '100';
$image->image_resize = true;
$image->image_ratio_fill = true;
echo $image->file_is_image;
echo $image->image_src_x;
echo $image->image_src_y;
$image->Process($target);
echo $image->log;
}
And the Log:
system information - class version : 0.28 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : c:\websites;c:\windows\temp;c:\Temp - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension MIME type detected as image/png; charset=binary by Fileinfo PECL extension source variables - You can use all these before calling process() file_src_name : accept_male_user_24.png file_src_name_body : accept_male_user_24 file_src_name_ext : png file_src_pathname : C:\Temp\php3E54.tmp file_src_mime : image/png; charset=binary file_src_size : 1354 (max= 3145728) file_src_error : 0 process file to temp/accept_male_user_24.png\ - file size OK - file mime OK : image/png; charset=binary - new file name ext : png - new file name body : test_main - file name safe format - destination variables file_dst_path : temp/accept_male_user_24.png\ file_dst_name_body : test_main file_dst_name_ext : png - no image operation, keep extension - checking for auto_rename auto_rename to test_main_6.png - destination file details file_dst_name : test_main_6.png file_dst_pathname : temp/accept_male_user_24.png\test_main_6.png - test_main_6.png doesn't exist already - no image processing wanted - process OK
I had a problem with the class when I enabled fileinfo, until I updated the class which fixed it. Now the images won't resize. Below is my code:
And the Log:
system information
- class version : 0.28
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : c:\websites;c:\windows\temp;c:\Temp
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MIME type detected as image/png; charset=binary by Fileinfo PECL extension
source variables
- You can use all these before calling process()
file_src_name : accept_male_user_24.png
file_src_name_body : accept_male_user_24
file_src_name_ext : png
file_src_pathname : C:\Temp\php3E54.tmp
file_src_mime : image/png; charset=binary
file_src_size : 1354 (max= 3145728)
file_src_error : 0
process file to temp/accept_male_user_24.png\
- file size OK
- file mime OK : image/png; charset=binary
- new file name ext : png
- new file name body : test_main
- file name safe format
- destination variables
file_dst_path : temp/accept_male_user_24.png\
file_dst_name_body : test_main
file_dst_name_ext : png
- no image operation, keep extension
- checking for auto_rename
auto_rename to test_main_6.png
- destination file details
file_dst_name : test_main_6.png
file_dst_pathname : temp/accept_male_user_24.png\test_main_6.png
- test_main_6.png doesn't exist already
- no image processing wanted
- process OK
Can anyone see the problem?
Cheers.