久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

Discuz! 官方交流社區

標題: 圖片處理類 class_image.php 使用說明 [打印本頁]

作者: 117384790    時間: 2019-8-20 19:20
標題: 圖片處理類 class_image.php 使用說明
  1. /**
  2. * 圖片處理類
  3. *
  4. * @example
  5. *
  6. * require_once libfile('class/image');
  7. * $img = new image;
  8. * $r = $img->Thumb($attachfile, '', $w, $h, 'fixwr');            //生成 $attachfile.'thumb.jpg' 為文件名的縮略圖
  9. * $r = $img->Thumb($attachfile, 'temp/test.jpg', $w, $h, 'fixwr');    //生成 /data/attachment/test/test.jpg' 為文件名的縮略圖
  10. * if($r) {
  11. *    $isthumb = $r;
  12. * } else {
  13. *    $error = $img->error();
  14. *    showmessage('Thumb Error');
  15. * }
  16. *
  17. * $r = $img->Watermark($attachfile);                    //為 $attachfile 加水印
  18. * if(!$r) {
  19. *    $error = $img->error();
  20. *    showmessage('Watermark Error');
  21. * }
  22. *
  23. */
復制代碼
  1. /*
  2.      * $this->error() 返回值(用于處理失敗時)
  3.      *     0: 圖片不符合處理條件,無需處理正常退出
  4.      *    -1: $source 為無效的圖片文件
  5.      *    -2: 文件權限不足無法處理圖片($source 圖片無法讀取、$target 路徑不可寫)
  6.      *    -3: 系統設置錯誤無法處理圖片
  7.      *    -4: 服務器缺少處理圖片所需的功能
  8.      */
復制代碼
  1. /**
  2.      * 生成圖片的縮略圖
  3.      * @param $source 圖片源路徑
  4.      * @param $target 生成的縮略圖路徑,路徑為相對 data/attachment/ 的文件名
  5.      *    本地圖片省略時自動加后綴 .thumb.jpg,遠程圖片無法省略
  6.      * @param $thumbwidth 縮略寬度
  7.      * @param $thumbheight 縮略高度
  8.      * @param $thumbtype 縮略方法
  9.      *    fixnone / 1 : 小于指定大小、保持比率(默認)
  10.      *      fixwr / 2 : 與指定大小相同、保持比率,超出部分剪切
  11.      * @param $nosuffix 縮略圖路徑不加 .thumb.jpg 后綴
  12.      * @return 是否處理完畢
  13.      */
  14.     function Thumb($source, $target, $thumbwidth, $thumbheight, $thumbtype = 1, $nosuffix = 0)
復制代碼
  1. /**
  2.      * 生成圖片的水印
  3.      * @param $source 圖片源路徑
  4.      * @param $target 生成的圖片路徑,省略表示同 $source
  5.      * @param $type forum - 論壇; portal - 門戶; album - 空間相冊
  6.      * @return 是否處理完畢
  7.      */
  8.     function Watermark($source, $target = '', $type = 'forum')
復制代碼







歡迎光臨 Discuz! 官方交流社區 (http://www.9999xn.com/) Powered by Discuz! W1.0