ImageCopyResized works on JPG but not PNG?
| From: | Jough P | Date: | Fri, 09 Jul 2004 22:38:22 +0000 |
| Subject: | ImageCopyResized works on JPG but not PNG? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-190114@lists.php.net to get a copy of this message | ||
Greetings all, I have a real simple function. I works well on JPG images but ImageCopyResized(), or ImagePNG() doesn't seem to be working. When I view the uploaded file it is still it's original size. Here is the function. I hope someone can help me, I'm pretty stumped.
function transform_to_profile_pic()
{
$path = $this->origpath;
$type = $this->type;
# make jpg or png image
$img_dst = imagecreatetruecolor(PROFILE_IMAGE_W,PROFILE_IMAGE_H);
if($type == 2)
$img_src = imagecreatefromjpeg($path);
else if($type == 3)
$img_src = imagecreatefrompng($path);
# Overwrite the original with the resized image to the filesystem
imagecopyresized($img_dst, $img_src, 0, 0, 0, 0, PROFILE_IMAGE_W, PROFILE_IMAGE_H, imagesx($img_src), imagesy($img_src)
if($type == 2)
imagejpeg($img_dst, $path, 100);
else if($type == 3)
imagepng($img_dst, $path . ".png", 100);
}