Upload files

See all posts See thread Reply

Another Resize Issue new!
by choffman, 15 years, 6 months ago
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:

$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
Reply
Re: Another Resize Issue new!
by colin, 15 years, 6 months ago
The log says:
- MIME type detected as regular file by UNIX file() command
- file mime OK : regular file
- no image processing wanted


That means that the UNIX file command returned regular file as a MIME type, which is not correct. And then the class doesn't think that the file is a valid image, and deactivate image processing. which is why the file is uploaded, but not resized.

Could you please send me the picture privately, and also indicate here which OS you are running the script on?

What do you get if you run in a shell:
file -bi your_image.jpg
You should get a MIME type here, but in your case you seem to get regular file.Reply
Re: Another Resize Issue new!
by BPierre, 15 years, 4 months ago
I have the same problem (regular file), on OS X 10.5.Reply