当前位置: 首页>>代码示例>>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;未经允许,请勿转载。