문제

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?

도움이 되었습니까?

해결책

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

imagejpeg($im, 'img.jpg');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top