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 try to use $handle->allowed = array('image/jpg','image/jpeg');, but have error with processing JPEG: unsupported file type.... SAD. Changing to 'image/*' -- have not errors.Reply
Now I have construct that code:
// if file size is OK, processing without resizing // it is very important if ( $handle->image_src_x < 1025 && $handle->image_src_y < 769 ) { $handle->file_max_size = '307200'; $handle->allowed = array('image/*'); $handle->file_new_name_body = $add_data; $handle->image_min_width = 50; $handle->image_min_height = 50; $handle->process('gallery/data/'); } else { // create big foto 1024x768 pix, let users read rules $handle->image_resize = true; $handle->allowed = array('image/*'); $handle->file_max_size = '307200'; $handle->file_new_name_body = $add_data; $handle->image_x = 1024; $handle->image_y = 768; $handle->image_ratio_no_zoom_in = true; $handle->image_min_width = 50; $handle->image_min_height = 50; $handle->process('gallery/data/'); } // create thumbnail $handle->allowed = array('image/*'); $handle->file_max_size = '307200'; $handle->file_new_name_body = $add_data; $handle->image_resize = true; $handle->image_x = 200; $handle->image_y = 200; $handle->image_min_width = 50; $handle->image_min_height = 50; $handle->image_ratio = true; $handle->process('gallery/tmb/');I try to use $handle->allowed = array('image/jpg','image/jpeg');, but have error with processing JPEG: unsupported file type.... SAD. Changing to 'image/*' -- have not errors.