国产探花免费观看_亚洲丰满少妇自慰呻吟_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.  } 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乌拉特中旗| 锦屏县| 繁昌县| 黄骅市| 光山县| 忻州市| 阜康市| 阳泉市| 义乌市| 乳源| 黄山市| 祥云县| 大竹县| 新干县| 东乌珠穆沁旗| 永平县| 亳州市| 栾城县| 博白县| 清流县| 永吉县| 黄石市| 读书| 临泉县| 保德县| 莱州市| 玉山县| 茂名市| 红安县| 彭州市| 鹤庆县| 贵阳市| 镇康县| 拉萨市| 永寿县| 会东县| 兴隆县| 宝山区| 武夷山市| 隆昌县| 宝山区|