Hi
I have just a simple question I hope, but I couldn't find any answer on this question. If I use this command in PHP:
exec("convert filename.fileending -resize 200x200 filename.fileending);
but with different files (eg. .jpg / .gif / .png / .txt / .pdf / .doc / .xml..........)
Will ImageMagick actually only make changes on the typical image files (.jpg/.gif/.png...) or am I at risk that certain other filetypes get modified too? I am specially worried that weird things are happening, like that somebody uploads an Excel Sheet and it becomes corrupted.....
Do I need to check my filetype in PHP first or can I just let the command loose and ImageMagick ignores the non-image files?
Thanks!
Recognizing File Formats
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Recognizing File Formats
See http://www.imagemagick.org/Usage/files/#read
Convert stops if it can't read the image.
There is a chance, I suppose, that some random file might start with bytes that match an image type.
Convert stops if it can't read the image.
There is a chance, I suppose, that some random file might start with bytes that match an image type.
snibgo's IM pages: im.snibgo.com
Re: Recognizing File Formats
Thank you for the quick answer Snibgo.
Looks like a 99% goes it well solution. Mhmm, maybe I will build in a check before with getimagesize(), just to be sure.
Cheers!
Looks like a 99% goes it well solution. Mhmm, maybe I will build in a check before with getimagesize(), just to be sure.
Cheers!