国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php創建縮略圖程序

2024-09-04 11:44:26
字體:
來源:轉載
供稿:網友
  1. function Thumb_IM($thumbwidth$thumbheight$preview = 0) { 
  2.   global $thumbstatus$imageimpath$thumbquality
  3.   if($thumbstatus) { 
  4.    list($img_w$img_h) = $this->attachinfo; 
  5.    $targetfile = !$preview ? ($thumbstatus == 1 || $thumbstatus == 3 ? $this->targetfile.'.thumb.jpg' : $this->targetfile) : DISCUZ_ROOT.'./forumdata/watermark_temp.jpg'
  6.    if(!$this->animatedgif && ($img_w >= $thumbwidth || $img_h >= $thumbheight)) { 
  7.     if($thumbstatus != 3) { 
  8.      $exec_str = $imageimpath.'/convert -quality '.intval($thumbquality).' -geometry '.$thumbwidth.'x'.$thumbheight.' '.$this->targetfile.' '.$targetfile
  9.      @exec($exec_str$output$return); 
  10.      if(emptyempty($return) && emptyempty($output)) { 
  11.       $this->attach['thumb'] = $thumbstatus == 1 ? 1 : 0; 
  12.      } 
  13.     } else { 
  14.      $imgratio = $img_w / $img_h
  15.      $thumbratio = $thumbwidth / $thumbheight
  16.      if($imgratio >= 1 && $imgratio >= $thumbratio || $imgratio < 1 && $imgratio > $thumbratio) { 
  17.       $cuty = $img_h
  18.       $cutx = $cuty * $thumbratio
  19.      } elseif($imgratio >= 1 && $imgratio <= $thumbratio || $imgratio < 1 && $imgratio < $thumbratio) { 
  20.       $cutx = $img_w
  21.       $cuty = $cutx / $thumbratio
  22.      } 
  23.      $exec_str = $imageimpath.'/convert -crop '.$cutx.'x'.$cuty.'+0+0  '.$this->targetfile.' '.$targetfile
  24.      @exec($exec_str$output$return); 
  25.      $exec_str = $imageimpath.'/convert -quality '.intval($thumbquality).' -geometry '.$thumbwidth.'x'.$thumbheight.' '.$targetfile.' '.$targetfile
  26.      @exec($exec_str$output$return); 
  27.      if(emptyempty($return) && emptyempty($output)) { 
  28.       $this->attach['thumb'] = $thumbstatus == 1 || $thumbstatus == 3 ? 1 : 0; 
  29.      }//開源代碼Vevb.com 
  30.     } 
  31.              } 
  32.   } 
  33.  } 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 确山县| 科尔| 类乌齐县| 兴宁市| 白银市| 涞水县| 台州市| 陆丰市| 韩城市| 禄劝| 南乐县| 萨迦县| 紫阳县| 阳曲县| 厦门市| 河源市| 宿迁市| 武川县| 乌海市| 天等县| 平武县| 天峨县| 克什克腾旗| 台南市| 苍山县| 类乌齐县| 乌审旗| 渑池县| 台东市| 台州市| 安阳县| 绩溪县| 靖安县| 松原市| 泰兴市| 喀喇| 扶余县| 郯城县| 古蔺县| 巴塘县| 绥德县|