调用在这里:if (strlen($_FILES['pfile']['tmp_name'])>0 && $_FILES['pfile']['tmp_name'] != "none") {
$sname = $_FILES['pfile']['tmp_name']; 
$preview_id = substr($_FILES['pfile']['name'],0,-4);
$preview_dir = "./img/small/".$preview_id;
// preview
if (!$maxsize)
$maxsize = 100;
$thumb=new makepic();
$thumb->thumbnail($sname,$_FILES['pfile']['type']);
$thumb->size_auto($maxsize);
$thumb->jpeg_quality(100);
$thumb->show();
}

解决方案 »

  1.   

    是不是缩略图有链接的?链接上要加上border=0
    比如:<img src=24.jpg  border=0>
      

  2.   

    这样取整。
    function size_height($size=100)
    {
    //height
         $this->img["tinggi_thumb"]=$size;
         @$this->img["lebar_thumb"] =ceil(($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"]);
    } function size_width($size=100)
    {
    //width
    $this->img["lebar_thumb"]=$size;
         @$this->img["tinggi_thumb"] =ceil(($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"]);
    } function size_auto($size=100)
    {
    //size
    if ($this->img["lebar"]>=$this->img["tinggi"]) {
         $this->img["lebar_thumb"]=$size;
         @$this->img["tinggi_thumb"] =ceil(($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"]);
    } else {
         $this->img["tinggi_thumb"]=$size;
         @$this->img["lebar_thumb"] =ceil(($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"]);
      }
    }
      

  3.   


    GD 2.0.l 或更高版本
    imagecopyresized换成imagecopyresampled
    图像质量也好点。
      

  4.   

    誰有好的生成縮略圖的PHP程序類阿??發給我好嗎??[email protected]謝謝了!!!!!  標題請寫明。因爲現在太多垃圾郵件啦
      

  5.   

    这个缩略图最简单了,不知道楼主喜欢吗?
    <?php
    /* 
     * 图片缩略图 
     * $srcfile 源图片,$rate 缩放比,默认为缩小一半
     * 例如: resizeimage("zt32.gif",".1");
     */
    function resizeimage($srcfile,$rate=.5){
    $size=getimagesize($srcfile);
    switch($size[2]){
    case 1:
    $img=imagecreatefromgif($srcfile);
    break;
    case 2:
    $img=imagecreatefromjpeg($srcfile);
    break;
    case 3:
    $img=imagecreatefrompng($srcfile);
    break;
    }
    //源图片的宽度和高度
    $srcw=imagesx($img);
    $srch=imagesy($img);
    //目的图片的宽度和高度
    $dstw=floor($srcw*$rate);
    $dsth=floor($srch*$rate);
    //新建一个真彩色图像
    $im=imagecreatetruecolor($dstw,$dsth);
    $black=imagecolorallocate($im,255,255,255);

    imagefilledrectangle($im,0,0,$dstw,$dsth,$black);
    imagecopyresized($im,$img,0,0,0,0,$dstw,$dsth,$srcw,$srch);
    // 以 JPEG 格式将图像输出到浏览器或文件
    header("content-type: image/jpeg");
    imagejpeg($im);
    //释放图片
    imagedestroy($im);
    imagedestroy($img);}
    resizeimage("zt32.gif",".1");
    ?>
      

  6.   

    找到原因了,还是GD版本问题,这样就可以了:
    ImageCreateTrueColor to ImageCreate