Having a problem...
or not a problem.. but when i resize images with imagecopyresized() it returns me an image with an afoul quality.. not worth it!
i want good quality! why is it like this?
code:
function make_thumb($imagefile, $new_w=100, $new_h=75)
{
// get source image info.
$img_data=getimagesize($imagefile);
$src_w=$img_data[0];
$src_h=$img_data[1];
$src_type=$img_data[2];
// get source image
switch ($src_type)
{
case 1:
$src_img=ImageCreateFromGIF($imagefile) or die ("Cannot open source");
break;
case 2:
$src_img=ImageCreateFromJPEG($imagefile) or die ("Cannot open source");
break;
case 3:
$src_img=ImageCreateFromPNG($imagefile) or die ("Cannot open source");
break;
}
// if the image already exists blow it away.
if ( file_exists("thumb_".$imagefile) )
{
unlink("thumb_".$imagefile);
}
// I use thumb_ to show that it is a thumbnail.
// save the new image as a png.
switch ($src_type)
{
case 1:
imagegif($dst_img,"thumb_".$imagefile);
break;
case 2:
imagejpeg($dst_img,"thumb_".$imagefile);
break;
case 3:
imagepng($dst_img,"thumb_".$imagefile);
break;
}
// free up the memory.
ImageDestroy($src_img);
ImageDestroy($dst_img);
}