本文整理汇总了PHP中base_storager类的典型用法代码示例。如果您正苦于以下问题:PHP base_storager类的具体用法?PHP base_storager怎么用?PHP base_storager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了base_storager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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'];
}
示例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'];
}
示例4: remove
/**
* 根据image_id删除二维码图片
*/
public function remove($image_id)
{
$imageModel = app::get('image')->model('image');
$imageData = $imageModel->getRow('image_id,ident,url,storage', array('image_id' => $image_id));
if (!$imageData) {
return true;
}
//删除storager中存储的图片数据
$storager = new base_storager();
$ident_data = $imageData['url'] . '|' . $imageData['ident'] . '|' . $imageData['storage'];
$res = $storager->remove($ident_data, 'image');
$imageModel->delete(array('image_id' => $image_id));
return true;
}
示例5: brand
/**
* 品牌数据.
*/
public function brand($params)
{
$mdl_brand = app::get('b2c')->model('brand');
$filter = array('disabled' => 'false');
foreach ($params as $key => $value) {
switch ($key) {
case 'brand_id':
case 'brand_initial':
$filter[$key] = explode(',', $value);
break;
case 'brand_name':
$filter[$key . '|has'] = $value;
break;
}
}
$brand_list = $mdl_brand->getList('brand_id,brand_name,brand_initial,brand_logo', $filter);
if (!$brand_list) {
$this->failure();
}
foreach ($brand_list as &$brand) {
$brand['brand_logo'] = base_storager::image_path($brand['brand_logo']);
$brand['detail_url'] = app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_list', 'args' => array($brand['brand_id'])));
}
$this->success($brand_list);
}
示例6: detail_qrcode
public function detail_qrcode($gid)
{
$mobile_url = vmc::singleton('mobile_router')->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_product', 'act' => 'index', 'args' => array('g' . $gid), 'full' => 1));
$qrcode_image = vmc::singleton('wechat_qrcode')->create($mobile_url);
$url = base_storager::image_path($qrcode_image['image_id']);
return "<img src='{$url}' />";
}
示例7: input_image
function input_image($params)
{
$params['type'] = 'image';
$ui = new base_component_ui($this);
$domid = $ui->new_dom_id();
$input_name = $params['name'];
$input_value = $params['value'];
$image_src = base_storager::image_path($input_value, 's');
if (!$params['width']) {
$params['width'] = 50;
}
if (!$params['height']) {
$params['height'] = 50;
}
$imageInputWidth = $params['width'] + 24;
$url = ""index.php?app=desktop&act=alertpages&goto=" . urlencode("index.php?app=image&ctl=admin_manage&act=image_broswer") . """;
$html = '<div class="image-input clearfix" style="width:' . $imageInputWidth . 'px;" gid="' . $domid . '">';
$html .= '<div class="flt"><div class="image-input-view" style="font-size:12px;text-align:center;width:';
$html .= $params['width'] . 'px;line-height:' . $params['height'] . 'px;height:' . $params['height'] . 'px;overflow:hidden;">';
if (!$image_src) {
$image_src = app::get('desktop')->res_url . '/transparent.gif';
}
$html .= '<img src="' . $image_src . '" onload="$(this).zoomImg(' . $params['width'] . ',' . $params['height'] . ',function(mw,mh,v){this.setStyle("marginTop",(mh-v.height)/2)});"/>';
$html .= '</div></div>';
$html .= '<div class="image-input-handle" onclick="Ex_Loader("modedialog",function(){new imgDialog(' . $url . ',{handle:this});}.bind(this));" style="width:20px;height:' . $params['height'] . 'px;">' . app::get('desktop')->_('选择') . "" . $ui->img(array('src' => 'bundle/arrow-down.gif', 'app' => 'desktop'));
$html .= '</div>';
$html .= '<input type="hidden" name="' . $input_name . '" value="' . $input_value . '"/>';
$html .= '</div>';
return $html;
}
示例8: shopex_brand_list
function shopex_brand_list()
{
$params = $this->params;
//api 调用合法性检查
$this->check($params);
$params['page_no'] = isset($params['page_no']) ? $params['page_no'] : 1;
$params['page_size'] = isset($params['page_size']) ? $params['page_size'] : 20;
$page_no = intval($params['page_no']) - 1;
$page_size = intval($params['page_size']);
$page_offset = $page_no * $page_size;
if ($params['page_no'] == -1) {
$item_total = $this->brand_model->count();
$data['item_total'] = $item_total;
$this->send_success($data);
} else {
$item_total = $this->brand_model->count();
$brands = $this->brand_model->getList("*", array(), $page_offset, $page_size);
}
foreach ($brands as $key => $value) {
//将brand_logo图片id 转化为可直接访问的地址
$brand_logo = base_storager::image_path($value['brand_logo']);
$data[$key] = array('brand_name' => $value['brand_name'], 'brand_url' => $value['brand_url'], 'brand_desc' => $value['brand_desc'], 'brand_logo' => substr($brand_logo, 0, -13), 'brand_alias' => $value['brand_keywords'], 'disabled' => $value['disabled'] ? 'true' : 'false', 'order_by' => $value['ordernum'], 'brand_setting' => serialize($value['brand_setting']), 'last_modify' => time());
}
$data['item_total'] = $item_total;
$this->send_success($data);
}
示例9: input_image
function input_image($params)
{
$params['type'] = 'image';
$ui = new base_component_ui($this);
$domid = $ui->new_dom_id();
$input_name = $params['name'];
$input_value = $params['value'];
$image_src = base_storager::image_path($input_value, 's');
if (!$params['width']) {
$params['width'] = 50;
}
if (!$params['height']) {
$params['height'] = 50;
}
$imageInputWidth = $params['width'] + 24;
$url = ""index.php?app=desktop&act=alertpages&goto=" . urlencode("index.php?app=image&ctl=admin_manage&act=image_broswer") . """;
$html = '<div class="image-input clearfix" style="width:' . $imageInputWidth . 'px;" gid="' . $domid . '">';
$html .= '<div class="flt"><div class="image-input-view" style="display:table-cell;text-align:center;vertical-align: middle;width:';
$html .= $params['width'] . 'px;height:' . $params['height'] . 'px;font-size:' . $params['height'] * 0.875 . 'px;overflow:hidden;">';
$html .= '<img src="' . $image_src . '" onload="$(this).zoomImg(' . $params['width'] . ',' . $params['height'] . ');"/>';
$html .= '</div></div>';
$html .= '<div class="image-input-handle" onclick="new imgDialog(' . $url . ',{handle:this});" style="width:20px;height:' . $params['height'] . 'px;">选择' . $ui->img(array('src' => 'bundle/arrow-down.gif', 'app' => 'desktop'));
$html .= '</div>';
$html .= '<input type="hidden" name="' . $input_name . '" value="' . $input_value . '"/>';
$html .= '</div>';
return $html;
}
示例10: get_goods_spec
public function get_goods_spec()
{
$gid = $this->_request->get_post('gid');
if (!$gid) {
exit('error!');
}
$this->pagedata['goodshtml']['name'] = kernel::single("b2c_goods_detail_name")->show($gid, $arrGoods);
if ($arrGoods['spec'] && is_array($arrGoods['spec'])) {
foreach ($arrGoods['spec'] as $row) {
$option = $row['option'];
if ($option && is_array($option)) {
foreach ($option as $img) {
foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
$return[$imageid] = base_storager::image_path($imageid, 's');
}
}
}
}
}
$arrGoods['spec2image'] = json_encode($return);
$this->pagedata['goods'] = $arrGoods;
$this->pagedata['goodshtml']['spec'] = kernel::single("b2c_goods_detail_spec")->show($gid, $arrGoods);
$imageDefault = app::get('image')->getConf('image.set');
$this->pagedata['image_default_id'] = $imageDefault['S']['default_image'];
$this->page('site/index/spec.html', true);
}
示例11: get_goods_spec
public function get_goods_spec()
{
$gid = $this->_request->get_get('gid');
if (!$gid) {
echo '';
exit;
}
$this->pagedata['goodshtml']['name'] = kernel::single("b2c_goods_detail_name")->show($gid, $arrGoods);
if ($arrGoods['spec'] && is_array($arrGoods['spec'])) {
foreach ($arrGoods['spec'] as $row) {
$option = $row['option'];
if ($option && is_array($option)) {
foreach ($option as $img) {
foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
$return[$imageid] = base_storager::image_path($imageid, 's');
}
}
}
}
}
$this->pagedata['spec2image'] = json_encode($return);
$imageDefault = app::get('image')->getConf('image.set');
$this->pagedata['defaultImage'] = $imageDefault['S']['default_image'];
$arrGoods['spec2image'] = json_encode($return);
$this->pagedata['goods'] = $arrGoods;
$this->pagedata['goodshtml']['spec'] = kernel::single("b2c_goods_detail_spec")->show($gid, $arrGoods);
$imageDefault = app::get('image')->getConf('image.set');
$this->pagedata['image_default_id'] = $imageDefault['S']['default_image'];
$this->pagedata['goodshtml']['button'] = kernel::single('b2c_goods_detail_button')->show($gid, $arrGoods);
$this->pagedata['form_url'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_cart', 'act' => 'add', 'arg0' => 'goods', 'arg1' => 'quick'));
$this->page('site/gallery/spec_dialog.html', true);
}
示例12: modifier_avatar
public function modifier_avatar($col)
{
$img_src = base_storager::image_path($col);
if (!$img_src) {
return '';
}
return "<a href='{$img_src}' target='_blank'><img class='img-thumbnail' src='{$img_src}' style='height:30px;'></a>";
}
示例13: modifier_avatar
public function modifier_avatar($col)
{
if (!$col) {
return '';
}
$url = base_storager::image_path($col);
return "<img src={$url} class='img-circle' width=20 height=20>";
}
示例14: modifier_logo
public function modifier_logo($col)
{
if (!$col) {
return '';
}
$img_url = base_storager::image_path($col, 'xs');
return '<img class="img-thumbnail img-circle" width="30" src="' . $img_url . '">';
}
示例15: column_content_pic
public function column_content_pic($row)
{
$img_src = base_storager::image_path($row['@row']['image_id'], 'xs');
if (!$img_src) {
return '';
}
return "<img class='img-thumbnail' src='{$img_src}' style='height:30px;'>";
}