當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Image::water方法代碼示例

本文整理匯總了PHP中Image::water方法的典型用法代碼示例。如果您正苦於以下問題:PHP Image::water方法的具體用法?PHP Image::water怎麽用?PHP Image::water使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Image的用法示例。


在下文中一共展示了Image::water方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hd_uploadify

 /**
  * Uploadify上傳文件處理
  */
 public function hd_uploadify()
 {
     $uploadModel = M('upload');
     //上傳文件類型
     if (isset($_POST['type'])) {
         $type = str_replace('*.', '', $_POST['type']);
         $type = explode(';', $type);
     } else {
         $type = array();
     }
     $size = Q('size') ? Q('size') : C('allow_size');
     $upload = new Upload(Q('upload_dir'), $type, $size);
     $file = $upload->upload();
     if (!empty($file)) {
         $file = $file[0];
         $file['uid'] = $_SESSION['user']['uid'];
         //圖片加水印
         if ($file['image'] && Q('water')) {
             $img = new Image();
             $img->water($file['path']);
         }
         //寫入upload表
         $uploadModel->add($file);
         $data = $file;
         $data['status'] = 1;
     } else {
         $data['status'] = 0;
         $data['message'] = $upload->error;
     }
     echo json_encode($data);
     exit;
 }
開發者ID:suhanyujie,項目名稱:spider,代碼行數:35,代碼來源:ContentUploadController.class.php

示例2: hd_uploadify

 /**
  * Uploadify上傳文件處理
  */
 public function hd_uploadify()
 {
     $uploadModel = M('upload');
     $size = Q('size') ? Q('size') : C('allow_size');
     $upload = new Upload(Q('post.upload_dir'), array(), $size);
     $file = $upload->upload();
     if (!empty($file)) {
         $file = $file[0];
         $file['uid'] = session('uid');
         //圖片加水印
         if ($file['image'] && Q('water')) {
             $img = new Image();
             $img->water($file['path']);
         }
         //寫入upload表
         $uploadModel->add($file);
         $data = $file;
         $data['status'] = 1;
         $data['isimage'] = $file['image'] ? 1 : 0;
     } else {
         $data['status'] = 0;
         $data['message'] = $upload->error;
     }
     echo json_encode($data);
     exit;
 }
開發者ID:lililishuang,項目名稱:hdcms,代碼行數:29,代碼來源:ContentUploadController.class.php

示例3: do_it

 function do_it($image, $ImgWaterPath, $ImgWaterPos, $ImageWaterAlpha, $i)
 {
     echo "正在處理第" . $i . "張圖片:" . $image . "<br/>";
     flush();
     ob_flush();
     Image::water($image, $ImgWaterPath, $ImgWaterPos, '', $ImageWaterAlpha);
 }
開發者ID:dalinhuang,項目名稱:concourse,代碼行數:7,代碼來源:WaterAction.class.php

示例4: down_img

 public function down_img($url, $mid = 'video')
 {
     $chr = strrchr($url, '.');
     $imgUrl = uniqid();
     $imgPath = $mid . '/' . date(C('upload_style'), time()) . '/';
     $imgPath_s = './' . C('upload_path') . '-s/' . $imgPath;
     $filename = './' . C('upload_path') . '/' . $imgPath . $imgUrl . $chr;
     $get_file = get_collect_file($url);
     if ($get_file) {
         write_file($filename, $get_file);
         //是否添加水印
         if (C('upload_water')) {
             import('ORG.Util.Image');
             Image::water($filename, C('upload_water_img'), '', C('upload_water_pct'), C('upload_water_pos'));
         }
         //是否生成縮略圖
         if (C('upload_thumb')) {
             mkdirss($imgPath_s);
             import('ORG.Util.Image');
             Image::thumb($filename, $imgPath_s . $imgUrl . $chr, '', C('upload_thumb_w'), C('upload_thumb_h'), true);
         }
         //是否上傳遠程
         if (C('upload_ftp')) {
             $this->ftp_upload($imgPath . $imgUrl . $chr);
         }
         return $imgPath . $imgUrl . $chr;
     } else {
         return $url;
     }
 }
開發者ID:skygunner,項目名稱:ekucms,代碼行數:30,代碼來源:AdminAction.class.php

示例5: upload

 public function upload()
 {
     echo '<div style="font-size:12px; height:30px; line-height:30px">';
     $uppath = './' . C('upload_path') . '/';
     $uppath_s = './' . C('upload_path') . '-s/';
     $mid = trim($_POST['mid']);
     $fileback = !empty($_POST['fileback']) ? trim($_POST['fileback']) : 'picurl';
     if ($mid) {
         $uppath .= $mid . '/';
         $uppath_s .= $mid . '/';
         $backpath = $mid . '/';
     }
     import("ORG.Net.UploadFile");
     $up = new UploadFile();
     //$up->maxSize = 3292200;
     $up->savePath = $uppath;
     $up->saveRule = uniqid;
     $up->uploadReplace = true;
     $up->allowExts = explode(',', C('cms_exts'));
     $up->autoSub = true;
     $up->subType = date;
     $up->dateFormat = C('upload_style');
     if (!$up->upload()) {
         $error = $up->getErrorMsg();
         if ($error == '上傳文件類型不允許') {
             $error .= ',可上傳<font color=red>' . C('cms_exts') . '</font>';
         }
         exit($error . ' [<a href="?s=Admin/Upload/Show/mid/' . $mid . '/fileback/' . $fileback . '">重新上傳</a>]');
         //dump($up->getErrorMsg());
     }
     $uploadList = $up->getUploadFileInfo();
     //是否添加水印
     if (C('upload_water')) {
         import("ORG.Util.Image");
         Image::water($uppath . $uploadList[0]['savename'], C('upload_water_img'), '', C('upload_water_pct'), C('upload_water_pos'));
     }
     //是否生成縮略圖
     if (C('upload_thumb')) {
         $thumbdir = substr($uploadList[0]['savename'], 0, strrpos($uploadList[0]['savename'], '/'));
         mkdirss($uppath_s . $thumbdir);
         import("ORG.Util.Image");
         Image::thumb($uppath . $uploadList[0]['savename'], $uppath_s . $uploadList[0]['savename'], '', C('upload_thumb_w'), C('upload_thumb_h'), true);
     }
     //是否遠程圖片
     if (C('upload_ftp')) {
         $img = D('Down');
         $img->ftp_upload($backpath . $uploadList[0]['savename']);
     }
     echo "<script type='text/javascript'>parent.document.getElementById('" . $fileback . "').value='" . $backpath . $uploadList[0]['savename'] . "';</script>";
     echo '文件<a href="' . $uppath . $uploadList[0]['savename'] . '" target="_blank"><font color=red>' . $uploadList[0]['savename'] . '</font></a>上傳成功 [<a href="?s=Admin/Upload/Show/mid/' . $mid . '/fileback/' . $fileback . '">重新上傳</a>]';
     echo '</div>';
 }
開發者ID:singhvicky,項目名稱:pintrest,代碼行數:52,代碼來源:UploadAction.class.php

示例6: upload

 public function upload()
 {
     $upload = new \Think\Upload();
     //  實例化上傳類
     $upload->savePath = './Uploads/';
     $info = $upload->upload($_FILES);
     if ($info) {
         import('Common/Org/Util/Image');
         $img = new \Image();
         $img->water($info['upfile']['savepath'] . $info['upfile']['savename']);
         echo json_encode(array('url' => ltrim($info['upfile']['savepath'] . $info['upfile']['savename'], '.'), 'title' => htmlspecialchars($_POST['pictitle'], ENT_QUOTES), 'original' => $info['upfile']['name'], 'state' => 'SUCCESS'));
     } else {
         echo json_encode(array('state' => $upload->getError()));
     }
 }
開發者ID:xupp,項目名稱:ThinkPHP,代碼行數:15,代碼來源:SinglepageController.class.php

示例7: _upload

 protected function _upload()
 {
     import('@.ORG.UploadFile');
     //導入上傳類
     $upload = new UploadFile();
     //設置上傳文件大小
     $upload->maxSize = 3292200;
     //設置上傳文件類型
     $upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
     //設置附件上傳目錄
     $upload->savePath = './Uploads/';
     //設置需要生成縮略圖,僅對圖像文件有效
     $upload->thumb = true;
     // 設置引用圖片類庫包路徑
     $upload->imageClassPath = '@.ORG.Image';
     //設置需要生成縮略圖的文件後綴
     $upload->thumbPrefix = 'm_,s_';
     //生產2張縮略圖
     //設置縮略圖最大寬度
     $upload->thumbMaxWidth = '400,100';
     //設置縮略圖最大高度
     $upload->thumbMaxHeight = '400,100';
     //設置上傳文件規則
     $upload->saveRule = 'uniqid';
     //刪除原圖
     $upload->thumbRemoveOrigin = true;
     if (!$upload->upload()) {
         //捕獲上傳異常
         $this->error($upload->getErrorMsg());
     } else {
         //取得成功上傳的文件信息
         $uploadList = $upload->getUploadFileInfo();
         import('@.ORG.Image');
         //給m_縮略圖添加水印, Image::water('原文件名','水印圖片地址')
         Image::water($uploadList[0]['savepath'] . 'm_' . $uploadList[0]['savename'], APP_PATH . 'Tpl/Public/Images/logo.png');
         $_POST['image'] = $uploadList[0]['savename'];
     }
     $model = M('Photo');
     //保存當前數據對象
     $data['image'] = $_POST['image'];
     $data['create_time'] = NOW_TIME;
     $list = $model->add($data);
     if ($list !== false) {
         $this->success('上傳圖片成功!');
     } else {
         $this->error('上傳圖片失敗!');
     }
 }
開發者ID:highestgoodlikewater,項目名稱:examples,代碼行數:48,代碼來源:IndexAction.class.php

示例8: upload

 public function upload()
 {
     import('ORG.Net.UploadFile');
     $upload = new UploadFile();
     $upload->autoSub = true;
     $upload->subType = 'date';
     $upload->dateFormat = 'Ym';
     if ($upload->upload('./Uploads/')) {
         $info = $upload->getUploadFileInfo();
         // import('ORG.Util.Image');
         // Image::water('./Uploads/' . $info[0]['savename'], './Data/fff.png');
         import('Class.Image', APP_PATH);
         Image::water('./Uploads/' . $info[0]['savename'], './Data/fff.png');
         echo json_encode(array('url' => $info[0]['savename'], 'title' => htmlspecialchars($POST['pictitle'], ENT_QUOTES), 'original' => $info[0]['name'], 'state' => 'SUCCESS'));
     } else {
         echo json_encode(array('state' => $upload->getErrorMsg()));
     }
 }
開發者ID:plsxysam,項目名稱:blog_ThinkPHP,代碼行數:18,代碼來源:BlogAction.class.php

示例9: index

 public function index()
 {
     import('ORG.Net.UploadFile');
     $upload = new UploadFile();
     $upload->autoSub = true;
     $upload->subType = 'date';
     $upload->dateFormat = 'Ym';
     $CONFIG = json_decode(preg_replace("/\\/\\*[\\s\\S]+?\\*\\//", "", file_get_contents(CONF_PATH . "config.json")), true);
     $action = htmlspecialchars($_GET['action']);
     switch ($action) {
         case 'config':
             $result = json_encode($CONFIG);
             break;
             /* 上傳圖片 */
         /* 上傳圖片 */
         case 'uploadimage':
             if ($upload->upload('./Uploads/')) {
                 $info = $upload->getUploadFileInfo();
                 //引入外部的圖像類處理水印
                 import('Class.Image', APP_PATH);
                 Image::water('./Uploads/' . $info[0]['savename']);
                 echo json_encode(array('url' => __ROOT__ . '/Uploads/' . $info[0]['savename'], 'original' => $info[0]['name'], 'state' => 'SUCCESS'));
             } else {
                 echo json_encode(array('state' => $upload->getErrorMsg()));
             }
             break;
         default:
             $result = json_encode(array('state' => '請求地址出錯'));
             break;
     }
     /* 輸出結果 */
     if (isset($_GET["callback"])) {
         if (preg_match("/^[\\w_]+\$/", $_GET["callback"])) {
             echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
         } else {
             echo json_encode(array('state' => 'callback參數不合法'));
         }
     } else {
         echo $result;
     }
 }
開發者ID:thinksley,項目名稱:movie,代碼行數:41,代碼來源:UeditorAction.class.php

示例10: uploads

 /**
  * 多文件上傳
  *
  * @param boolean $thumb [description]
  * @return [type]         [description]
  */
 public static function uploads($params = false)
 {
     $conf = Config::get('', 'base');
     $params['thumbSize'] = array(400, 400);
     Yii::import('application.vendors.*');
     require_once 'Tp/UploadFile.class.php';
     $upload = new UploadFile();
     // 設置上傳文件大小
     $maxSize = isset($params['maxSize']) ? $params['maxSize'] : $conf['upload_max_size'];
     $upload->maxSize = $maxSize * 1024;
     // 設置上傳文件類型
     $upload->allowExts = isset($params['allowExts']) ? explode(',', $params['allowExts']) : explode(',', $conf['upload_allow_ext']);
     // 設置附件上傳目錄
     $upload->savePath = self::_saveRule($params);
     // 設置需要生成縮略圖,僅對圖像文件有效
     $upload->thumb = isset($params['thumb']) ? $params['thumb'] : $conf['thumb'];
     // 設置需要生成縮略圖的文件後綴
     $upload->thumbPrefix = 'thumb_';
     // 生產2張縮略圖
     // 設置縮略圖最大寬度
     $upload->thumbMaxWidth = $params['thumbSize'][0];
     // 設置縮略圖最大高度
     $upload->thumbMaxHeight = $params['thumbSize'][1];
     // 設置上傳文件規則
     $upload->saveRule = uniqid;
     // 刪除原圖
     $upload->thumbRemoveOrigin = false;
     if (!$upload->upload()) {
         return $upload->getErrorMsg();
     } else {
         $fileinfo = $upload->getUploadFileInfo();
         require_once 'Tp/Image.class.php';
         Image::water($fileget['pathname'], './' . $conf['upload_water_file'], null, $conf['upload_water_trans']);
         foreach ($fileinfo as $key => $row) {
             if (true == $upload->thumb) {
                 $fileinfo[$key]['thumb'] = $upload->thumbPrefix . $fileinfo[$key]['savename'];
             }
             $fileinfo[$key]['pathname'] = $upload->savePath . $fileinfo[$key]['savename'];
             $fileinfo[$key]['paththumbname'] = $upload->savePath . $upload->thumbPrefix . $fileinfo[$key]['savename'];
             if ($conf['upload_water_status'] == 'open') {
                 Image::water($fileinfo[$key]['pathname'], './' . $conf['upload_water_file'], null, $conf['upload_water_trans']);
             }
         }
         return $fileinfo;
     }
 }
開發者ID:tecshuttle,項目名稱:51qsk,代碼行數:52,代碼來源:XUpload.php

示例11: _upload

 protected function _upload()
 {
     import("@.ORG.UploadFile");
     $upload = new UploadFile();
     //設置上傳文件大小
     $upload->maxSize = 3292200;
     //設置上傳文件類型
     $upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
     //設置附件上傳目錄
     $upload->savePath = 'Tpl/default/Public/Uploads/';
     //設置需要生成縮略圖,僅對圖像文件有效
     $upload->thumb = true;
     // 設置引用圖片類庫包路徑
     $upload->imageClassPath = '@.ORG.Image';
     //設置需要生成縮略圖的文件後綴
     $upload->thumbPrefix = 'm_,s_';
     //生產2張縮略圖
     //設置縮略圖最大寬度
     $upload->thumbMaxWidth = '400,100';
     //設置縮略圖最大高度
     $upload->thumbMaxHeight = '400,100';
     //設置上傳文件規則
     $upload->saveRule = uniqid;
     //刪除原圖
     $upload->thumbRemoveOrigin = true;
     if (!$upload->upload()) {
         //捕獲上傳異常
         $this->error($upload->getErrorMsg());
     } else {
         //取得成功上傳的文件信息
         $uploadList = $upload->getUploadFileInfo();
         import("@.ORG.Image");
         //給m_縮略圖添加水印, Image::water('原文件名','水印圖片地址')
         Image::water($uploadList[0]['savepath'] . 'm_' . $uploadList[0]['savename'], '../Public/Images/logo2.png');
         $_POST['image'] = $uploadList[0]['savename'];
     }
     if ($list !== false) {
         //$this->success('上傳圖片成功!');
         return $uploadList;
     } else {
         return false;
         //$this->error('上傳圖片失敗!');
     }
 }
開發者ID:baowzh,項目名稱:adminrightlist,代碼行數:44,代碼來源:goodsAction.class.php

示例12: upload

 function upload()
 {
     import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     //檢查客戶端上傳文件參數設置
     if (isset($_POST['_uploadFileSize']) && is_numeric($_POST['_uploadFileSize'])) {
         //設置上傳文件大小
         $upload->maxSize = $_POST['_uploadFileSize'];
     } else {
         $upload->maxSize = C('FILE_UPLOAD_MAXSIZE');
     }
     /*if (! empty ( $_POST ['_uploadFileType'] )) {
     		//設置上傳文件類型
     		$upload->allowExts = explode ( ',', strtolower ( $_POST ['_uploadFileType'] ) );
     		} else {
     		$upload->allowExts = explode ( ',', C ( 'FILE_UPLOAD_ALLOWEXTS' ) );
     		}*/
     $upload->allowExts = explode(',', C('FILE_UPLOAD_ALLOWEXTS'));
     if (!empty($_POST['_uploadSavePath'])) {
         //設置附件上傳目錄
         $upload->savePath = $_POST['_uploadSavePath'];
     } else {
         $upload->savePath = "./Public/Uploads/" . MODULE_NAME . "/";
     }
     //是否自動命名
     if (GetSettValue('uploadsaveRule') == 1) {
         if (isset($_POST['_uploadSaveRule'])) {
             //設置附件命名規則
             $upload->saveRule = $_POST['_uploadSaveRule'];
         } else {
             $upload->saveRule = 'uniqid';
         }
     }
     if (MODULE_NAME == 'Products') {
         //創建目錄
         $upload->savePath = $upload->savePath . toDate(time(), 'Ymd') . "/";
         if (!file_exists("{$upload->savePath}")) {
             mk_dir($upload->savePath);
         }
         //設置需要生成縮略圖,僅對圖像文件有效
         $upload->thumb = true;
         //設置需要生成縮略圖的文件後綴
         //$upload->thumbSuffix = "_thumb";
         //設置縮略圖最大寬度
         $upload->thumbMaxWidth = GetSettValue('ImgThumbW');
         //設置縮略圖最大高度
         $upload->thumbMaxHeight = GetSettValue('ImgThumbH');
     }
     $upload->uploadReplace = true;
     if (!$upload->upload()) {
         $error = $upload->getErrorMsg();
         $this->ajaxReturn('', $error, 0);
     } else {
         $uploadSuccess = true;
         $uploadList = $upload->getUploadFileInfo();
         //是否打上水印
         $imgwater = GetSettValue('ImgWater');
         $ImageWaterAlpha = GetSettValue('ImageWaterAlpha');
         if (empty($ImageWaterAlpha)) {
             $ImageWaterAlpha = 80;
         }
         import("ORG.Util.Image");
         foreach ($uploadList as $key => $file) {
             $savename['savename'] = $upload->savePath . $file['savename'];
             if ($imgwater == 1) {
                 if (GetSettValue('is_only_proimg_water') == 1 && MODULE_NAME == 'Products') {
                     Image::water($savename['savename'], GetSettValue('ImgWaterPath'), GetSettValue('ImgWaterPos'), '', $ImageWaterAlpha);
                 } elseif (GetSettValue('is_only_proimg_water') == 0) {
                     Image::water($savename['savename'], GetSettValue('ImgWaterPath'), GetSettValue('ImgWaterPos'), '', $ImageWaterAlpha);
                 }
             }
             $savename['name'] = $file['name'];
         }
         $this->ajaxReturn($savename, '上傳成功!', 1);
     }
 }
開發者ID:dalinhuang,項目名稱:concourse,代碼行數:76,代碼來源:AdminCommAction.class.php

示例13: save

 /**
 * 保存圖片
 * @param array $key $_FILES 中的鍵名 為空則保存 $_FILES 中的所有圖片
 * @param string $dir 保存的目錄 為空則保存到臨時目錄
 * @param bool $is_thumb 是否縮略圖片
 * @param array $whs 縮略圖大小信息 為空則取後台設置,並返回 大圖鍵名big 小圖鍵名small
 	可生成多個縮略圖
 		數組 參數1 為寬度,
 			 參數2為高度,
 			 參數3為處理方式:0(縮放,默認),1(剪裁),
 			 參數4為是否水印 默認為 0(不生成水印)
 	array(
 			'thumb1'=>array(300,300,0,0),
 			'thumb2'=>array(100,100,0,0),
 			...
 		),
 * @param bool $is_delete_origin 是否刪除原圖(當有縮略圖時,此設置才生效)
 * @param bool $is_water 是否水印
 * @return array
 	如果隻有一個圖片,則返回
 		array(
 			'name'=>圖片名稱,
 			'url'=>原圖web路徑,
 			'path'=>原圖物理路徑,
 			有略圖時
 			'thumb'=>array(
 				'thumb1'=>array('url'=>web路徑,'path'=>物理路徑),
 				'thumb2'=>array('url'=>web路徑,'path'=>物理路徑),
 				...
 			)
 		)
 		如果有多個圖片,則返回(key 為 $_FILES 中的鍵名)
 		array(
 			'key'=>array(
 				'name'=>圖片名稱,
 				'url'=>原圖web路徑,
 				'path'=>原圖物理路徑,
 				有略圖時
 				'thumb'=>array(
 					'thumb1'=>array('url'=>web路徑,'path'=>物理路徑),
 					'thumb2'=>array('url'=>web路徑,'path'=>物理路徑),
 					...
 				)
 			)
 			....
 		)
 */
 public function save($key = '', $dir = 'temp', $is_thumb = false, $whs = array(), $is_delete_origin = false, $is_water = false)
 {
     global $_FANWE;
     include_once fimport('class/image');
     $image = new Image();
     if (intval($_FANWE['setting']['max_upload']) > 0) {
         $image->max_size = intval($_FANWE['setting']['max_upload']);
     }
     $list = array();
     if (empty($key)) {
         foreach ($_FILES as $fkey => $file) {
             $list[$fkey] = false;
             $image->init($file, $dir);
             if ($image->save()) {
                 $list[$fkey] = array();
                 $list[$fkey]['url'] = $image->file['target'];
                 $list[$fkey]['path'] = $image->file['local_target'];
                 $list[$fkey]['name'] = $image->file['prefix'];
             }
         }
     } else {
         $list[$key] = false;
         $image->init($_FILES[$key], $dir);
         if ($image->save()) {
             $list[$key] = array();
             $list[$key]['url'] = $image->file['target'];
             $list[$key]['path'] = $image->file['local_target'];
             $list[$key]['name'] = $image->file['prefix'];
         }
     }
     $water_image = FANWE_ROOT . $_FANWE['setting']['water_image'];
     $water_mark = intval($_FANWE['setting']['water_mark']);
     $alpha = intval($_FANWE['setting']['water_alpha']);
     $place = intval($_FANWE['setting']['water_position']);
     if ($is_thumb) {
         if (empty($whs)) {
             $big_width = intval($_FANWE['setting']['big_width']);
             $big_height = intval($_FANWE['setting']['big_height']);
             $small_width = intval($_FANWE['setting']['small_width']);
             $small_height = intval($_FANWE['setting']['small_height']);
             $thumb_type = intval($_FANWE['setting']['auto_gen_image']);
             $whs = array('big' => array($big_width, $big_height, $thumb_type, $water_mark), 'small' => array($small_width, $small_height, 1, 0));
         }
     }
     foreach ($list as $lkey => $item) {
         if ($is_thumb) {
             foreach ($whs as $tkey => $wh) {
                 $list[$lkey]['thumb'][$tkey]['url'] = false;
                 $list[$lkey]['thumb'][$tkey]['path'] = false;
                 if ($wh[0] > 0 || $wh[1] > 0) {
                     $thumb_bln = false;
                     $thumb_type = isset($wh[2]) ? intval($wh[2]) : 0;
                     if ($thumb = $image->thumb($item['path'], $wh[0], $wh[1], $thumb_type)) {
//.........這裏部分代碼省略.........
開發者ID:dalinhuang,項目名稱:concourse,代碼行數:101,代碼來源:image.service.php

示例14: upload

 /**
  * 圖片上傳處理
  * @param 
  * @return 
  */
 public function upload()
 {
     import('ORG.Net.UploadFile');
     $config = array('autoSub' => true, 'subType' => 'date', 'dateFormat' => 'Ymd', 'savePath' => './uploads/');
     $upload = new UploadFile($config);
     if ($upload->upload()) {
         $info = $upload->getUploadFileInfo();
         //引入自己寫的Imaage類
         import('Class.Image', APP_PATH);
         //實例化水印(water)方法
         Image::water('./uploads/' . $info[0]['savename']);
         echo json_encode(array('url' => $info[0]['savename'], 'title' => htmlspecialchars($_POST['pictitle'], ENT_QUOTES), 'original' => $info[0]['name'], 'state' => 'SUCCESS'));
     } else {
         echo json_encode(array('state' => $upload->getErrorMsg()));
     }
     /**
      * 向瀏覽器返回數據json數據
      * {
      *   'url'      :'a.jpg',   //保存後的文件路徑
      *   'title'    :'hello',   //文件描述,對圖片來說在前端會添加到title屬性上
      *   'original' :'b.jpg',   //原始文件名
      *   'state'    :'SUCCESS'  //上傳狀態,成功時返回SUCCESS,其他任何值將原樣返回至圖片上傳框中
      * }
      */
 }
開發者ID:badguy2015,項目名稱:asugar,代碼行數:30,代碼來源:BlogAction.class.php

示例15: Upload

 case 'uploadimage':
     /* 上傳塗鴉 */
 /* 上傳塗鴉 */
 case 'uploadscrawl':
     /* 上傳視頻 */
 /* 上傳視頻 */
 case 'uploadvideo':
     /* 上傳文件 */
 /* 上傳文件 */
 case 'uploadfile':
     $upload = new Upload($CONFIG['imagePathFormat']);
     if ($info = $upload->upload()) {
         //加水印
         if ($_GET['water'] == 1) {
             $image = new Image();
             $image->water($info[0]['path']);
         }
         $info = $info[0];
         $result = json_encode(array("state" => "SUCCESS", "url" => $info['url'], "title" => $info['filename'], "original" => $info['name'], "type" => $info['ext'], "size" => $info['size']));
     } else {
         $result = json_encode(array('state' => $upload->error));
     }
     break;
     /* 列出圖片 */
 /* 列出圖片 */
 case 'listimage':
     $result = (include "action_list.php");
     break;
     /* 列出文件 */
 /* 列出文件 */
 case 'listfile':
開發者ID:www2511550,項目名稱:ECSHOP,代碼行數:31,代碼來源:ueditor_upload.php


注:本文中的Image::water方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。