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.
This is the output, I also swapped out the lines you recommended:
system information - class version : 0.30 - operating system : Linux - PHP version : 5.2.9 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : /php/includes/:/usr/local/pem/vhosts/134438 - upload_max_filesize : 16M (16777216 bytes) - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command MIME type detected as image/jpeg by UNIX file() command - MIME validated as image/jpeg source variables - You can use all these before calling process() file_src_name : Deerfire_high_res.jpg file_src_name_body : Deerfire_high_res file_src_name_ext : jpg file_src_pathname : /usr/local/pem/vhosts/134438/tmp/phpBg6bd4 file_src_mime : image/jpeg file_src_size : 1167592 (max= 16777216) file_src_error : 0 - source file is an image image_src_x : 1731 image_src_y : 1069 image_src_pixels : 1850439 image_src_type : jpg image_src_bits : 8 process file to ../photos/small/ - file size OK - file mime OK : image/jpeg - new file name body : 9-1290977425 - file name safe format - destination variables file_dst_path : ../photos/small/ file_dst_name_body : 9_1290977425 file_dst_name_ext : jpg - no image operation, keep extension - checking for auto_rename - destination file details file_dst_name : 9_1290977425.jpg file_dst_pathname : ../photos/small/9_1290977425.jpg - 9_1290977425.jpg doesn't exist already - no image processing wanted - process OKReply
system information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.9
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : /php/includes/:/usr/local/pem/vhosts/134438
- upload_max_filesize : 16M (16777216 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : Deerfire_high_res.jpg
file_src_name_body : Deerfire_high_res
file_src_name_ext : jpg
file_src_pathname : /usr/local/pem/vhosts/134438/tmp/phpBg6bd4
file_src_mime : image/jpeg
file_src_size : 1167592 (max= 16777216)
file_src_error : 0
- source file is an image
image_src_x : 1731
image_src_y : 1069
image_src_pixels : 1850439
image_src_type : jpg
image_src_bits : 8
process file to ../photos/small/
- file size OK
- file mime OK : image/jpeg
- new file name body : 9-1290977425
- file name safe format
- destination variables
file_dst_path : ../photos/small/
file_dst_name_body : 9_1290977425
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 9_1290977425.jpg
file_dst_pathname : ../photos/small/9_1290977425.jpg
- 9_1290977425.jpg doesn't exist already
- no image processing wanted
- process OK