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.
Colin, I have successfully got it to upload files to the server, but when I'm trying to crop and rezise I got into some trouble ... Maybe u can help me out?
I have one file on the server: pic400px_original.jpg It is width: 400px and height: 495px
Now I need to crop and rezise it. Crop is working, but file is saved in the crop size, say 363px by 363px and not 400px by 400px as I need it rezised to ... ( Later I also need 128px by 128px and 48px by 48px ... When this works ;) )
So, can you check my code below and see if you can tell me where I messed up?
I have one file on the server: pic400px_original.jpg
It is width: 400px and height: 495px
Now I need to crop and rezise it.
Crop is working, but file is saved in the crop size, say 363px by 363px
and not 400px by 400px as I need it rezised to ...
( Later I also need 128px by 128px and 48px by 48px ... When this works ;) )
So, can you check my code below and see if you can tell me where I messed up?
$ul_handle = new upload($fname_original); // members/profileimg/0000001_0000500/0000001/pic400px_original.jpg if ($ul_handle->uploaded) { $px_filename = "pic400px"; $ul_handle->image_x = 400; $ul_handle->image_y = 400; $ul_handle->file_overwrite = true; $ul_handle->file_auto_rename = false; $ul_handle->image_ratio_crop = true; $ul_handle->file_new_name_body = $px_filename; $ul_handle->image_convert = "jpg"; // Make sure I always get jpg files: png, jpg, gif, bmp $ul_handle->image_crop = array(34, 0, 98, 37); $ul_handle->Process($upload_path); // members/profileimg/0000001_0000500/0000001 }