Image Resize Problem
Posted: Thu Mar 20, 2003 5:07 pm
I want to resize a 400 x 300 px JPEG image to 200 x 150 px. However, when I use the code below I always get an error:
"Warning: imagejpeg() [function.imagejpeg]: Unable to open 'images/products/test2.jpg' for writing in /usr/local/psa/home/vhosts/lezazou.com/httpdocs/ImageSize.php on line 44"
This is the code I am using:
Note: I cannot use imagecreatetruecolor() or imagecopyresample() due to host limations. I understand the resized image will have poor quality.
Any help would be appreciated
"Warning: imagejpeg() [function.imagejpeg]: Unable to open 'images/products/test2.jpg' for writing in /usr/local/psa/home/vhosts/lezazou.com/httpdocs/ImageSize.php on line 44"
This is the code I am using:
Code: Select all
<?php
$src_img = imagecreatefromjpeg("images/products/test.jpg");
$dst_img = imagecreate(200,150);
imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, 200, 150, 400, 300);
imagejpeg($dst_img, 'images/products/test2.jpg', '75');
imagedestroy($src_img);
imagedestroy($dst_img);
?>Note: I cannot use imagecreatetruecolor() or imagecopyresample() due to host limations. I understand the resized image will have poor quality.
Any help would be appreciated