Hi all,
This is what I want to do: upload an image with move_uploaded_file() . When the image is too big (in terms of resolution) it should be scaled. I use the gd imagecopyresampled() function but I can't get it to work.
I first upload the image with the move_uploaded_file() function. When the upload is done it will check for the image resolution. If its to big it should be scaled with imagecopyresampled()...
for some strange reason this doesn't seem to work. The image is uploaded correct but not scaled. This is how the scaling is done...
// image is uploaded with move_uploaded_file() function () here
//...
if ($size[0] > 380) // if the image exceeds a certain size
{
$srcImg = imagecreatefromjpeg("$uploaddir$fileName");
$dstImg = imagecreate(dstSizeW, dstSizeH);
imagecopyresampled ($dstImg, $srcImg, 0, 0, 0, 0,380,380,$size[0], $size[1]);
imagedestroy($srcImg);
imagedestroy($dstImg);
}
$uploaddir$fileName contains the location of the image placed there with the move_uploaded_file() function.
Someone has an idea why this doesnt work?
kind regards
Stijn