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


PHP base_storager::save_upload方法代碼示例

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


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

示例1: create

 public function create($intext, $long_touch)
 {
     $mdl_image = app::get('image')->model('image');
     if ($exits_image = $mdl_image->dump(md5($intext . $long_touch))) {
         return $exits_image;
     }
     $tmp_file = tempnam(TMP_DIR, 'qrcode');
     wechat_qrcode_QRcode::png($intext, $tmp_file, 'L', 8, 4);
     list($w, $h, $type) = getimagesize($tmp_file);
     if ($long_touch) {
         //加入額外圖像
         $resize_tmp_file = tempnam(TMP_DIR, 'qrcode_resize');
         $image_tool = vmc::singleton('image_tools_gd');
         $image_tool->resize($tmp_file, $resize_tmp_file, $w, $h, $type, $w + 180, $h + 220, false, 20);
         $water_file = PUBLIC_DIR . '/misc/long_touch.gif';
         list($w_w, $w_h, $w_type) = getimagesize($water_file);
         $warermark_set = array('wm_opacity' => 100, 'watermark_width' => $w_w, 'watermark_height' => $w_h, 'type' => $w_type, 'src_width' => $w + 180, 'src_height' => $h + 180, 'dest_x' => ($w + 180 - 120) / 2, 'dest_y' => $h + 50);
         $image_tool->watermark($resize_tmp_file, $water_file, $warermark_set);
     }
     $storager = new base_storager();
     if ($long_touch) {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($resize_tmp_file, 'image', '', $msg, '.png'));
     } else {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($tmp_file, 'image', '', $msg, '.png'));
     }
     $tmp_qrcode_image = array('image_id' => md5($intext . $long_touch), 'storage' => $storage, 'image_name' => 'TMP_QRCODE', 'ident' => $ident, 'url' => $url, 'width' => $w, 'height' => $h, 'last_modified' => time());
     $mdl_image->save($tmp_qrcode_image);
     unlink($tmp_file);
     if ($long_touch) {
         unlink($resize_tmp_file);
     }
     return $tmp_qrcode_image;
 }
開發者ID:yindonghai,項目名稱:msk.com,代碼行數:33,代碼來源:qrcode.php

示例2: store

 /**
  * 存儲圖片的信息的接口方法
  * @param string filename
  * @param string image_id唯一標識
  * @param string size規格類型
  * @param string 圖片的名稱
  * @param boolean 是否要大水印
  * @return stirng image_id唯一標識
  */
 function store($file, $image_id, $size = null, $name = null, $watermark = false)
 {
     if (!defined(FILE_STORAGER)) {
         define('FILE_STORAGER', 'filesystem');
     }
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = FILE_STORAGER;
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $params['watermark'] = $watermark;
     if (is_bool($params['watermark'])) {
         $params['watermark'] = $params['watermark'] ? 'true' : 'false';
     }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode("|", $storager->save_upload($file, 'image', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     // Andrew 20120929
     // 圖片上傳的位置,在此處將圖片轉移到又拍雲上
     $services = kernel::servicelist("custom.image.save");
     foreach ($services as $service) {
         $service->save($params);
     }
     return $params['image_id'];
 }
開發者ID:syjzwjj,項目名稱:quyeba,代碼行數:65,代碼來源:image.php

示例3: store

 /**
  * 存儲圖片的信息的接口方法.
  *
  * @param string filename
  * @param string image_id唯一標識
  * @param string size規格類型
  * @param string 圖片的名稱
  * @param bool 是否要大水印
  *
  * @return stirng image_id唯一標識
  */
 public function store($file, $image_id, $size = null, $name = null, $watermark = false)
 {
     if (!defined('FILE_STORAGER')) {
         define('FILE_STORAGER', 'filesystem');
     }
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = constant('FILE_STORAGER');
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $params['watermark'] = 'false';
     // if(is_bool($params['watermark'])){
     // 	$params['watermark'] = $params['watermark'] ? 'true' : 'false';
     // }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode('|', $storager->save_upload($file, 'image', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     return $params['image_id'];
 }
開發者ID:yindonghai,項目名稱:msk.com,代碼行數:61,代碼來源:image.php

示例4: store

 /**
  * 根據需要生成二維碼的數據(URL),生成二維碼,並保存到storager
  *
  * $params string $data  可以是URL,文字
  */
 public function store($data, $matrixPointSize = null, $errorCorrectionLevel = null)
 {
     $matrixPointSize = $matrixPointSize ? $matrixPointSize : $this->matrixPointSize;
     $errorCorrectionLevel = $errorCorrectionLevel ? $errorCorrectionLevel : $this->errorCorrectionLevel;
     $imageModel = app::get('image')->model('image');
     $image_id = $this->gen_qrcode_image_id($data, $matrixPointSize, $errorCorrectionLevel);
     if (!$imageModel->getRow('image_id', array('image_id' => $image_id))) {
         $filename = tempnam($this->tmp_dir, 'qrcode');
         weixin_qrcode_QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
         list($w, $h) = getimagesize($filename);
         $storager = new base_storager();
         list($url, $ident, $storage) = explode("|", $storager->save_upload($filename, 'image', '', $msg, $this->extname));
         $params = array('image_id' => $image_id, 'storage' => $storage, 'image_name' => '二維碼圖片', 'ident' => $ident, 'url' => $url, 'width' => $w, 'height' => $h, 'last_modified' => time());
         $imageModel->save($params);
         unlink($filename);
     }
     return $image_id;
 }
開發者ID:noikiy,項目名稱:Ecstore-to-odoo,代碼行數:23,代碼來源:qrcode.php

示例5: store

 function store($file, $image_id, $size = null, $name = null)
 {
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = $this->app->getConf('system.default_storager');
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode("|", $storager->save_upload($file, '', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     return $params['image_id'];
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:43,代碼來源:image.php


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