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.
more info about the class
$uploaddir = FULL_PATH.'images/users/'; $upload = new upload($_FILES['profilepicture']); $upload->allowed = array('image/jpeg','image/pjpeg','image/jpg','image/gif','image/png'); $upload->file_new_name_body = $username; $upload->image_convert = 'jpg'; $upload->jpeg_quality = 80; $upload->image_resize = true; $upload->image_ratio_fill = true; $upload->image_y = 100; $upload->image_x = 100; $upload->image_background_color = '#FFFFFF'; $upload->file_max_size = '204800'; $upload->file_overwrite = true; $upload->file_auto_rename = false; $upload->process($uploaddir);
Script Parameters:
Upload Log:
No JPEG create support.system information
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : tr_TR
source is an uploaded file
- upload OK
- file name OK
- source variables
file_src_name : 2280694464_63b050929d_o.jpg
file_src_name_body : 2280694464_63b050929d_o
file_src_name_ext : jpg
file_src_pathname : /tmp/phpZUuUG1
file_src_mime : image/jpeg
file_src_size : 25172 (max= 5242880)
file_src_error : 0
- source file is an image
image_src_x : 350
image_src_y : 324
image_src_pixels : 113400
image_src_type : jpg
image_src_bits : 8
process file to /home/eram/www/ogretmenlersitesi.com/images/users/
- file size OK
- file mime OK : image/jpeg
- new file name ext : jpg
- new file name body : admin
- file name safe format
- destination variables
file_dst_path : /home/eram/www/ogretmenlersitesi.com/images/users/
file_dst_name_body : admin
file_dst_name_ext : jpg
- image operation, change extension for conversion type
- no auto_rename if same filename exists
- destination file details
file_dst_name : admin.jpg
file_dst_pathname : /home/eram/www/ogretmenlersitesi.com/images/users/admin.jpg
- no overwrite checking
- image resizing or conversion wanted
- source image is JPEG
- resizing...
check x/y sizes
ratio_fill_y : -8 (-4;-4)
resized image object created
image_src_x y : 350 x 324
image_dst_x y : 100 x 92
- crop image : -4 0 -4 0
- converting...
fills in transparency with default color
- saving image...