Jump to content

php gd imagepng quality


bahearn

Recommended Posts

So, I am uploading two images one being a jpeg which uploads fine and resizes fine and another being a gif,png, or jpg but using imagepng to output the file. When I use image png the quality of the image is horrible any tips?

heres what the image looks like (it's the one in the middle not the blue background that loads in fine as imagejpg)

43788799.jpg

 

 

heres my code

list($width,$height)=getimagesize($uploadedfile);

$newwidth=200;

$newheight=200;

 

$tmp=imagecreatetruecolor($newwidth,$newheight);

 

 

$colorTransparent = imagecolortransparent($src);

imagepalettecopy($src, $tmp);

imagefill($tmp, 0, 0, $colorTransparent);

imagecolortransparent($src, $colorTransparent);

imagetruecolortopalette($tmp, true, 256);

 

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

$filename = "images/". $_FILES['file']['name'];

imagepng($tmp,$filename);

Link to comment
https://forums.phpfreaks.com/topic/168281-php-gd-imagepng-quality/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.