I've a local server running a website with IIS.
When i run (move_uploaded_file($tempfile, $uploadfile))
all goes well (POST method used).
Now i wish to compress the image, here is the code:
// Compress image
function compressImage($source, $destination, $quality) {
$info = getimagesize($source);
if ($info['mime'] == 'image/jpeg') {
$image = imagecreatefromjpeg($source);
} elseif ($info['mime'] == 'image/gif') {
$image = imagecreatefromgif($source);
} elseif ($info['mime'] == 'image/png') {
$image = imagecreatefrompng($source);
}
imagejpeg($image, $destination, $quality);
}
$foo= compressImage($tempfile, $uploadfile, 75);
who gives me 500 error.
Should i enable some plugin on the server side? I've tried a bunch of code, it still doesn't work (i've played also with dir names.. actually they goes well with move_uploaded_file)
edit: strange thing, the $tempfile content is: C:WindowsTempphp92AF.tmp without slashes, but it works moving the file.... $uploadfile instead, is: ../../../Users/admin/Documents/uploads/2image.png
And so.. i've figured out!
request tracing was not so useful (for me). Instead i've added those 2 small lines to my php code to log errors:
The first was
Resolved with:
in php.ini. Then another error about the permissions.
FYI