Closed temaqueja closed 11 years ago
The method "getFileExtension" is used only when using the "setImage" method (or when setting an image with the construct method). So, if you are having this problem is because you are trying to treat the temporary file instead of a "real" file.
This class was not intended to be used this way. You should first save the file in your server and then treat the image:
if (move_uploaded_file($_FILES['whatever']['tmp_name'], 'your_real_destination.ext'))
{
// Now you can / should use watimage with the resulting image file (your_real_destination.ext)
$watimage = new Watimage('your_real_destination.ext');
$watimage->whatever();
}
Instead of...
$watimage = new Watimage($_FILES['whatever']['tmp_name']);
$watimage->whatever();
Which is what you were doing, if I'm not wrong.
There is a problem with some hosting services or PHP versions that doesn't use filename extensions:
This is bad: Array ( [dirname] => /tmp [basename] => phpAp3r4W [filename] => phpAp3r4W ) => Array ( [0] => Can't get file extension of /tmp/phpAp3r4W )
This is ok: Array ( [dirname] => E:\easyphp13\binaries\tmp [basename] => phpC577.tmp [extension] => tmp [filename] => phpC577 )
Bypassing with an empty string as extension is working for my particular case: