http://expert.csdn.net/Expert/topic/2282/2282098.xml?temp=.311825

解决方案 »

  1.   

    因为imagecreatetruecolor()和imagecopyresampled()需要GD库2.0以上,所以我改为了
    imagecreate()和imagecopyresized();可是这样一改后,效果非常不好。跟你原来程序的效果差远了。哪里错了啊??我想要一幅清晰的缩略图,请帮忙啦,谢谢,快回复啊?
    function image_scale($image,$dst,$thumbw,$thumbh)
    {
    $size = getimagesize($image); // 获取原图大小
    $scale = min($thumbw/$size[0], $thumbh/$size[1]); // 计算缩放比例
    $width = (int)($size[0]*$scale);
    $height = (int)($size[1]*$scale);
    $deltaw = (int)(($thumbw - $width)/2);
    $deltah = (int)(($thumbh - $height)/2);$src_img = ImageCreateFromJPEG($image); // 载入原图  $dst_img = imagecreate($thumbw, $thumbh);
    $back = ImageColorAllocate($dst_img, 255,255,255); // 填充的背景色
    imagefill($dst_img,0,0,$back);ImageCopyResized($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img),ImageSY($src_img)); // 复制图片imagejpeg($dst_img,$dst); // 创建图片
    ImageDestroy($src_img);
    ImageDestroy($dst_img);
    }?>
      

  2.   

    用imagecreate时在gd2.x下会出现色彩失真所以要用imagecreateturecolor 真彩
    而在gd1.6.2下不会出现失真请告知你的gd的版本号
      

  3.   

    本机上的GD是2.0的,可是我申请的空间上的GD好象是1.6的,唠叨兄,这样怎么办啊?
    这样是不是生不成清晰的缩略图了????
      

  4.   

    我看了啊,没有发现新大陆啊,空间不支持imagecreatetruecolor()我应该怎么办????