当前位置: 首页>>代码示例>>PHP>>正文


PHP kernel::get_resource_host_url方法代码示例

本文整理汇总了PHP中kernel::get_resource_host_url方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::get_resource_host_url方法的具体用法?PHP kernel::get_resource_host_url怎么用?PHP kernel::get_resource_host_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kernel的用法示例。


在下文中一共展示了kernel::get_resource_host_url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: image_ids_to_urls

 private function image_ids_to_urls($image_ids)
 {
     if ($image_ids == null || count($image_ids) < 1) {
         return $image_ids;
     }
     $obj_image = app::get('image')->model('image');
     $resource_host_url = kernel::get_resource_host_url();
     $image_from_db = $obj_image->getList('image_id,storage,l_url,m_url,s_url', array('image_id|in' => $image_ids));
     foreach ($image_from_db as $imageRow) {
         $image_id = $imageRow['image_id'];
         $fmt_image[$image_id]['s_url'] = $imageRow['s_url'] ? $imageRow['s_url'] : $imageRow['url'];
         if ($fmt_image[$image_id]['s_url'] && !strpos($fmt_image[$image_id]['s_url'], '://')) {
             $fmt_image[$image_id]['s_url'] = $resource_host_url . '/' . $fmt_image[$image_id]['s_url'];
         }
         $fmt_image[$image_id]['m_url'] = $imageRow['m_url'] ? $imageRow['m_url'] : $imageRow['url'];
         if ($fmt_image[$image_id]['m_url'] && !strpos($fmt_image[$image_id]['m_url'], '://')) {
             $fmt_image[$image_id]['m_url'] = $resource_host_url . '/' . $fmt_image[$image_id]['m_url'];
         }
         $fmt_image[$image_id]['l_url'] = $imageRow['l_url'] ? $imageRow['l_url'] : $imageRow['url'];
         if ($fmt_image[$image_id]['l_url'] && !strpos($fmt_image[$image_id]['l_url'], '://')) {
             $fmt_image[$image_id]['l_url'] = $resource_host_url . '/' . $fmt_image[$image_id]['l_url'];
         }
     }
     return $fmt_image;
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:25,代码来源:brand.php

示例2: _img_list

    function _img_list()
    {
        $img = $this->app->model('image');
        $html = '';
        foreach ($img->getList('url,s_url,l_url,m_url,image_id,width,height,storage', $filter, 0, 20) as $item) {
            $url = '';
            if ($item['storage'] == 'filesystem') {
                $url = kernel::get_resource_host_url();
            }
            $url = $url . ($item['s_url'] ? $item['s_url'] : ($item['m_url'] ? $item['m_url'] : ($item['l_url'] ? $item['l_url'] : $item['url'])));
            if (max($item['width'], $item['height']) > 96) {
                $tag = ($item['width'] > $item['height'] ? 'width=' : 'height=') . '"96"';
            } else {
                $tag = '';
            }
            $html .= <<<EOF
            <div image_id="{$image_id}" style="text-align:center;vertical-align: middle;float:left;width:96px;height:96px;border:3px solid #ddd;margin:3px">
            <img {$tag} src="{$url}" />
            </div>
EOF;
        }
        $pager = view::ui()->pager(array('current' => 2, 'total' => 200, 'link' => 'javascript:' . $this->var_name . '.page(%d)', 'nobutton' => false));
        echo $html . $pager;
    }
开发者ID:453111208,项目名称:bbc,代码行数:24,代码来源:editor.php

示例3: _select_spec

 private function _select_spec($paramsSpec)
 {
     if ($this->pagedata['goods_spec_images']) {
         $specGoodsImagesArr = app::get('image')->model('image')->getList('image_id,s_url,url', array('image_id' => $this->pagedata['goods_spec_images']));
         $resource_host_url = kernel::get_resource_host_url();
         foreach ($specGoodsImagesArr as $row) {
             $row['s_url'] = $row['s_url'] ? $row['s_url'] : $row['url'];
             if ($row['s_url'] && !strpos($row['s_url'], '://')) {
                 $row['s_url'] = $resource_host_url . '/' . $row['s_url'];
             }
             $goodsImages[$row['image_id']] = $row['s_url'];
         }
     }
     foreach ((array) $paramsSpec as $specId => $selectSpecRow) {
         $selectionSpec[$specId] = $selectSpecRow;
         //当前规格选中数量
         $selectCount[$specId] = count($selectSpecRow['option']);
         //选中的规格
         foreach ($selectSpecRow['option'] as $privateSpecValueId => $option) {
             $selectSpecValueId[] = $option['spec_value_id'];
             unset($selectionSpec[$specId]['option'][$privateSpecValueId]);
             if ($selectSpecRow['spec_type'] == 'image') {
                 $option['spec_image_url'] = $option['spec_image'] ? base_storager::image_path($option['spec_image']) : $this->default_spec_image_url;
                 $option['spec_image'] = $option['spec_image'] ? $option['spec_image'] : $this->default_spec_image;
             }
             $selectionSpec[$specId]['option'][$option['spec_value_id']] = $option;
             //规格关联商品图片
             $spec_goods_images = $option['spec_goods_images'] ? explode(',', $option['spec_goods_images']) : array();
             $specGoodsImages = array();
             foreach ((array) $spec_goods_images as $key => $imageId) {
                 if ($goodsImages[$imageId]) {
                     $specGoodsImages[$key]['image_id'] = $imageId;
                     $specGoodsImages[$key]['image_url'] = $goodsImages[$imageId];
                 }
             }
             $selectionSpec[$specId]['option'][$option['spec_value_id']]['spec_goods_images'] = $specGoodsImages;
         }
     }
     return array('selectionSpec' => $selectionSpec, 'selectCount' => $selectCount, 'selectSpecValueId' => $selectSpecValueId);
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:40,代码来源:products.php

示例4: get_app_statics_host_url

 static function get_app_statics_host_url($local_flag = false)
 {
     //return kernel::get_resource_host_url($local_flag).substr(PUBLIC_DIR, strlen(ROOT_DIR)).'/app';
     return kernel::get_resource_host_url($local_flag) . '/app';
 }
开发者ID:453111208,项目名称:bbc,代码行数:5,代码来源:kernel.php

示例5: image_storage

 static function image_storage($content)
 {
     $blocks = preg_split('/%IMG_([0-9a-f]{32})_S_([a-z0-9\\:]*)_IMG%/', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     $c = count($blocks);
     $imglib = array();
     $img = array();
     for ($i = 0; $i < $c; $i++) {
         switch ($i % 3) {
             case 1:
                 $image_id = $blocks[$i];
                 $img[$image_id][$i] = array($blocks[$i + 1]);
                 $blocks[$i] =& $img[$image_id][$i][0];
                 break;
             case 2:
                 $img[$image_id][$i - 1][1] = $blocks[$i];
                 $blocks[$i] = '';
                 break;
         }
     }
     if ($img) {
         $db = kernel::database();
         foreach ($db->select($s = 'select image_id,url,s_url,m_url,l_url,last_modified,width,height from sdb_image_image where image_id in(\'' . implode("','", array_keys($img)) . '\')') as $r) {
             $imglib[$r['image_id']] = $r;
         }
         foreach ($img as $image_id => $sizes) {
             foreach ($sizes as $i => $item) {
                 switch ($item[0][0]) {
                     case 's':
                         $url = $imglib[$image_id]['s_url'] ? $imglib[$image_id]['s_url'] : $imglib[$image_id]['url'];
                         break;
                     case 'p':
                         $url = $imglib[$image_id]['s_url'] ? $imglib[$image_id]['s_url'] : $imglib[$image_id]['url'];
                         if (defined('ROOT_PZFRESH')) {
                             $url = ROOT_PZFRESH . '/' . $url;
                         }
                         break;
                     case 'm':
                         $url = $imglib[$image_id]['m_url'] ? $imglib[$image_id]['m_url'] : $imglib[$image_id]['url'];
                         break;
                     case 'l':
                         $url = $imglib[$image_id]['l_url'] ? $imglib[$image_id]['l_url'] : $imglib[$image_id]['url'];
                         break;
                     default:
                         $url = $imglib[$image_id]['url'];
                         break;
                 }
                 if ($url && !strpos($url, '://')) {
                     $resource_host_url = kernel::get_resource_host_url();
                     $url = $resource_host_url . '/' . $url;
                 }
                 $code = $r['width'] > $r['height'] ? 'w' : 'h';
                 $img[$image_id][$i][0] = $url ? $url . '?' . $imglib[$image_id]['last_modified'] . '#' . $code : '';
             }
         }
     }
     return implode('', $blocks);
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:57,代码来源:storager.php

示例6: _get_gids_image

 /**
  * 根据商品ID,获取到对应的默认图片
  * @params $imageIds array | string 图片ID
  * @params $gids array | string 商品ID
  */
 private function _get_gids_image($imageIds = false, $gids)
 {
     if (!$imageIds) {
         $goodData = app::get('b2c')->model('goods')->getList('goods_id,image_default_id', array('goods_id' => $gids));
         foreach ((array) $goodData as $goodsRow) {
             $gid = $goodsRow['goods_id'];
             $imageIds[$gid] = $goodsRow['image_default_id'];
         }
     }
     $imageData = app::get('image')->model('image')->getList('url,image_id,s_url,m_url,l_url,last_modified', array('image_id' => $imageIds));
     $resource_host_url = kernel::get_resource_host_url();
     foreach ((array) $imageData as $imageRow) {
         $image_id = $imageRow['image_id'];
         $imageUrl[$image_id]['s_url'] = $imageRow['s_url'] ? $imageRow['s_url'] : $imageRow['url'];
         if ($imageUrl[$image_id]['s_url'] && !strpos($imageUrl[$image_id]['s_url'], '://')) {
             $imageUrl[$image_id]['s_url'] = $resource_host_url . '/' . $imageUrl[$image_id]['s_url'];
         }
         $imageUrl[$image_id]['m_url'] = $imageRow['m_url'] ? $imageRow['m_url'] : $imageRow['url'];
         if ($imageUrl[$image_id]['m_url'] && !strpos($imageUrl[$image_id]['m_url'], '://')) {
             $imageUrl[$image_id]['m_url'] = $resource_host_url . '/' . $imageUrl[$image_id]['m_url'];
         }
         $imageUrl[$image_id]['l_url'] = $imageRow['l_url'] ? $imageRow['l_url'] : $imageRow['url'];
         if ($imageUrl[$image_id]['l_url'] && !strpos($imageUrl[$image_id]['l_url'], '://')) {
             $imageUrl[$image_id]['l_url'] = $resource_host_url . '/' . $imageUrl[$image_id]['l_url'];
         }
     }
     foreach ((array) $imageIds as $gid => $image_default_id) {
         $return[$gid] = $imageUrl[$image_default_id];
     }
     return $return;
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:36,代码来源:user.php


注:本文中的kernel::get_resource_host_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。