由于算法专利原因,gd1.6以后不再支持gif,但支持jpg,png,wbmp,如果可能的话用jpg代替,或则用gd1.6以前版本

解决方案 »

  1.   

    http://www.eaoo.com/design/list.asp?classid=2&Nclassid=9
      

  2.   

    那可以用php把gif转化为jpg么?
      

  3.   

    可以,gd的任何版本可以读取gif,1.6以上只不过不能写gif
      

  4.   

    放大和缩小都行
    <?php
    function extname($filename) {
      return strtolower(substr(strrchr($filename,"."),1));
    }function load_image($image) {
      switch(extname($image)) {
    case "png":
    $im = ImageCreateFromPNG($image);
    break;
    case "jpg":
    case "jpeg":
    $im = @ImageCreateFromJPEG($image); // 载入原图
    break;
    case "gif":
    $im = ImageCreateFromGIF($image); // 载入原图
    break;
      }
      return $im;
    }function create_image($width,$height,$red=255,$green=255,$blue=255) {
    if(function_exists("imagecreatetruecolor"))
    $im = imagecreatetruecolor($width,$height); // 创建目标图
    else
    $im = imagecreate($width,$height); // 创建目标图 $back = ImageColorAllocate($im,$red,$green,$blue); // 填充的背景色
    imagefill($im,0,0,$back);
    return $im;
    }function set_transparent($im,$index) {
    imagecolortransparent($im,$index);
    }$image = "csdn.gif"; // 原图
    $thumbw = 200; // 期望的目标图宽
    $thumbh = 80; // 期望的目标图高$size = getimagesize($image); // 获取原图大小
    $thumbw = $size[0]*2;
    $thumbh = $size[1]*2;
    $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 = load_image($image);
    $dst_img = create_image($thumbw, $thumbh,255,240,240);
    $c = imagecolorat($src_img,$size[0]/2,$size[1]*0.8);
    set_transparent($src_img,imagecolorat($src_img,$size[0]/2,$size[1]*0.8));if(function_exists("ImageCopyResampled"))
      ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img),ImageSY($src_img)); // 复制图片
    else
      ImageCopyResized($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img),ImageSY($src_img)); // 复制图片imagejpeg($dst_img); // 创建图片
    ImageDestroy($src_img);
    ImageDestroy($dst_img);
    ?>
      

  5.   

    gd可以支持gif,但可惜的是不能生成动画gif,我也在找解决办法。