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.
Hey Colin - First off, thanks for putting together such a great script! The script seems to be working fine except for the resize function. Any ideas and help would be great. My code and log output is below:
First off, thanks for putting together such a great script! The script seems to be working fine except for the resize function. Any ideas and help would be great. My code and log output is below:
$handle = new upload($_FILES['img_field']); $handle->image_resize = true; $handle->image_x = 75; $handle->image_ratio_y = true; $handle->jpeg_quality = 70; $handle->file_new_name_body = 'member_image'; $handle->file_safe_name = true; $handle->file_auto_rename = true; $handle->image_convert = 'jpg'; $handle->file_max_size = true; $handle->dir_auto_chmod = true; $handle->dir_chmod = 0777; $handle->Process('images/users/'); if ($handle->processed) { echo('Your image has been renamed, resized and converted to JPG.'); $handle->Clean(); echo(''.$handle->log.''); } else { echo 'error: ' . $handle->error; }The log:
system information
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
- MIME type detected as regular file by UNIX file() command
- source variables
file_src_name : test.png
file_src_name_body : test
file_src_name_ext : png
file_src_pathname : /private/var/tmp/phpKpWqw2
file_src_mime : regular file
file_src_size : 36021 (max= 2097152)
file_src_error : 0
process file to images/users/
- file size OK
- file mime OK : regular file
- new file name ext : jpg
- new file name body : member_image
- file name safe format
- destination variables
file_dst_path : images/users/
file_dst_name_body : member_image
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
auto_rename to member_image_1.jpg
- destination file details
file_dst_name : member_image_1.jpg
file_dst_pathname : images/users/member_image_1.jpg
- member_image_1.jpg doesn't exist already
- no image processing wanted
- process OK
cleanup
- delete temp file /private/var/tmp/phpKpWqw2