Domanda

Following my code:

list($width, $height) = getimagesize("dir");
$src = imagecreatefromjpeg("dir"); 
$im = imagecreatetruecolor(300, 300);
imagecopyresampled($im, $src, 0, 0, 0, 0, 300, 300, $width, $height);
imagejpeg($src, 'img.jpg');

It saves the image, but with the same size of originary image and not 300x300. How to solve?

È stato utile?

Soluzione

You have used wrong image handler with imagejpeg function. Use:

imagejpeg($im, 'img.jpg');
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top