Image processing on local server won't behave

See all posts Reply

Image processing on local server won't behave new!
by Sean Vesce, 14 years, 7 months ago
Amazing job on this class!

Uploads are working fine for me, but having some difficulty in getting the image processing working at all. Regardless of parameters passed for file processing, just getting the original file back. After reverting back to the class.php.upload test forms and running an Image Local Manipulation, I'm getting the same result.

Sample output:
system information
- class version : 0.28
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
source is a local file test.png
- local file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MAGIC path defaults to /usr/share/file/magic
MIME type detected as image/png; charset=binary by Fileinfo PECL extension
source variables
- You can use all these before calling process()
file_src_name : test.png
file_src_name_body : test
file_src_name_ext : png
file_src_pathname : test.png
file_src_mime : image/png; charset=binary
file_src_size : 36021 (max= 134217728)
file_src_error : 0
process file to test/
- file size OK
- file mime OK : image/png; charset=binary
- file name safe format
- destination variables
file_dst_path : test/
file_dst_name_body : test
file_dst_name_ext : png
- no image operation, keep extension
- checking for auto_rename
auto_rename to test_189.png
- destination file details
file_dst_name : test_189.png
file_dst_pathname : test/test_189.png
- test_189.png doesn't exist already
- no image processing wanted
- process OK


[... same results for the remaining images in the test]

GD is installed with support for common image types and the mime detection seems to be working, which rules out issues that others in the forums have had. Confused why I'm getting "- no image processing wanted" even with an the unmodified test supplied.

Any insight is appreciated. I'm sure its something totally boneheaded on my end.

SeanReply
Re: Image processing on local server won't behave new!
by colin, 14 years, 7 months ago
Apparently, the MIME type is wrongly detected:
MIME type detected as image/png; charset=binary by Fileinfo PECL extension

Try to deactivate the PECL Fileinfo detection (works from v 0.28):
$handle->mime_fileinfo = false;
This should deactivate Fileinfo, and use other techniques to detect the MIME type. If the detected MIME type is an image one, image processing should happen.

Let me know.Reply
Re: Image processing on local server won't behave new!
by Sean Vesce, 14 years, 7 months ago
Colin,

No luck.. See log below for a test to process an uploaded .JPG three times with the following variations on mime related parameters:

1) The first with -- $handle->mime_fileinfo = false;
2) The second with -- $handle->mime_check = false;
3) The third with -- $handle->mime_file = true;

Any further guidance is appreciated!

Sean

system information
- class version : 0.28
- 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
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MAGIC path defaults to /usr/share/file/magic
MIME type detected as image/jpeg; charset=binary by Fileinfo PECL extension
source variables
- You can use all these before calling process()
file_src_name : CI-1641.jpg
file_src_name_body : CI-1641
file_src_name_ext : jpg
file_src_pathname : /Applications/XAMPP/xamppfiles/temp/phpehc7sr
file_src_mime : image/jpeg; charset=binary
file_src_size : 42701 (max= 134217728)
file_src_error : 0
process file to _imagetest/
- file size OK
- file mime OK : image/jpeg; charset=binary
- file name safe format
- destination variables
file_dst_path : _imagetest/
file_dst_name_body : CI_1641
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
auto_rename to CI_1641_4.jpg
- destination file details
file_dst_name : CI_1641_4.jpg
file_dst_pathname : _imagetest/CI_1641_4.jpg
- CI_1641_4.jpg doesn't exist already
- no image processing wanted
- process OK
process file to _imagetest/
- file size OK
- file mime (not checked) : image/jpeg; charset=binary
- file name safe format
- destination variables
file_dst_path : _imagetest/
file_dst_name_body : CI_1641
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
auto_rename to CI_1641_5.jpg
- destination file details
file_dst_name : CI_1641_5.jpg
file_dst_pathname : _imagetest/CI_1641_5.jpg
- CI_1641_5.jpg doesn't exist already
- no image processing wanted
- process OK
process file to _imagetest/
- file size OK
- file mime OK : image/jpeg; charset=binary
- file name safe format
- destination variables
file_dst_path : _imagetest/
file_dst_name_body : CI_1641
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
auto_rename to CI_1641_6.jpg
- destination file details
file_dst_name : CI_1641_6.jpg
file_dst_pathname : _imagetest/CI_1641_6.jpg
- CI_1641_6.jpg doesn't exist already
- no image processing wanted
- process OK
cleanup
- delete temp file /Applications/XAMPP/xamppfiles/temp/phpehc7sr
Reply
Re: Image processing on local server won't behave new!
by colin, 14 years, 7 months ago
For some reason, your system returns the MIME type as image/jpeg; charset=binary.

I will issue a fix in the next version. Note that I am not supporting the class under Windows since I don't use it, and cannot test the class with it.

In the meantime, line 2607 in version 0.28, you can add the line:
$this->file_src_mime = str_replace('; charset=binary', '', $this->file_src_mime);
Reply
Re: Image processing on local server won't behave new!
by phprpap, 14 years, 5 months ago
yea i think it come from snow leopard installation, i have the same issue over here.Reply
Re: Image processing on local server won't behave new!
by Sean Vesce, 14 years, 7 months ago
Cheers Colin! That fixed the issue!

Just a quick note -- I'm running with XAMPP v 1.7.2 on Mac OSX V 10.6.1.

Again great job on this class and thank you for your support.

SeanReply
Re: Image processing on local server won't behave new!
by colin, 14 years, 7 months ago
Thank for the info. Maybe MIME detection is different on MacOS X, I will look into that.Reply
Re: Image processing on local server won't behave new!
by Dae, 14 years, 5 months ago
Thanks for Mac OS X fix!Reply