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


PHP ImageHelper::thumb方法代码示例

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


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

示例1: getThumb

 public function getThumb($size = null, $crop = true)
 {
     if (is_string($size)) {
         $size = ['width' => 64, 'height' => 64];
     }
     $dir = pathinfo($this->getPk(), PATHINFO_DIRNAME);
     $name = pathinfo($this->getPk(), PATHINFO_BASENAME);
     return ImageHelper::thumb($dir, $name, $size, $crop)->getSrc();
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:9,代码来源:RemoteApiBehavior.php

示例2: run

 public function run()
 {
     $val = $this->model->{$this->attribute};
     if (!$this->model->isNewRecord && $val) {
         $id = $this->id . get_class($this);
         $files_data = $this->model->uploadFiles();
         $attribute_data = $files_data[$this->attribute];
         $directory = trim($attribute_data['dir'], '/');
         $preview = ImageHelper::thumb($directory, $val, array('width' => null, 'height' => 128));
         $preview .= CHtml::ajaxLink('X', array('/main/helpAdmin/saveAttribute'), array('type' => 'post', 'data' => array('model' => get_class($this->model), 'id' => $this->model->primaryKey, 'attribute' => $this->attribute, 'value' => '', 'unlink_file' => $directory . '/' . $val), 'success' => 'js:function() {$("#' . $id . '").remove();}'), array('class' => 'btn btn-danger delete-img'));
         echo CHtml::tag('div', array('id' => $id), $preview);
     }
     echo CHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions);
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:14,代码来源:FileWidget.php

示例3: getThumb

 public function getThumb()
 {
     $img_url = '/../../upload/category/' . $this->pic;
     $trueimage = Yii::app()->request->hostInfo . Yii::app()->baseUrl . $img_url;
     if (F::isfile($trueimage)) {
         $img_thumb = Yii::app()->request->baseUrl . ImageHelper::thumb(750, 368, $img_url, array('method' => 'resize'));
         $img_thumb_now = CHtml::image($img_thumb, $this->name);
         return CHtml::link($img_thumb_now, $this->url, array('title' => $this->name));
     } else {
         return '没有图片';
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:12,代码来源:StoreCategory.php

示例4: PPTBox

                <div class="pd_slider_img">
                    <div id="xxx">
                        <script>
                            var box = new PPTBox();
                            box.width = 180; //宽度
                            box.height = 178;//高度
                            box.autoplayer = 5;//自动播放间隔时间
                            //box.add({"url":"图片地址","title":"悬浮标题","href":"链接地址"})
                            <?php 
$recommendItems = Item::model()->findAll(array('condition' => 'is_best=?', 'params' => array('1'), 'limit' => 3));
$num = count(recommendItems);
if ($num > 0) {
    foreach ($recommendItems as $value) {
        if ($value->getMainPic()) {
            $imageHelper = new ImageHelper();
            $picUrl = $imageHelper->thumb('180', '178', $value->getMainPic());
        } else {
            $picUrl = $value->getHolderJs('180', '178');
        }
        ?>
                                         box.add({"url": "<?php 
        echo $picUrl;
        ?>
", "href": "<?php 
        echo $this->createUrl('item/view', array('id' => $value->item_id));
        ?>
", "title": "<?php 
        echo $value->title;
        ?>
"});
                                    <?php 
开发者ID:lhfcainiao,项目名称:basic,代码行数:31,代码来源:index.php

示例5: getImage

 /**
  * 得到图片图像
  * @return type
  */
 public function getImage()
 {
     $img = $this->getImagePath();
     if (file_exists(dirname(F::basePath()) . $img)) {
         $img_thumb = F::baseUrl() . ImageHelper::thumb(990, 486, $img, array('method' => 'resize'));
         $img_thumb_now = CHtml::image($img_thumb, $this->title);
         return CHtml::link($img_thumb_now, $this->url, array('title' => $this->title));
     } else {
         return CHtml::link(CHtml::image($this->getHolderJs('990', '486')), $this->url, array('title' => $this->title));
     }
 }
开发者ID:yinhe,项目名称:yincart,代码行数:15,代码来源:Ad.php

示例6: getMainPic

 /**
  * get item main picture
  * @param string $width
  * @param string $height
  * @return mixed
  * @author milkyway(yhxxlm@gmail.com)
  */
 public function getMainPic($width = '310', $height = '310')
 {
     $img = $this->getMainPicPath();
     if (file_exists($this->getMainPicOriginalPath())) {
         $img_thumb = F::baseUrl() . ImageHelper::thumb($width, $height, $img, array('method' => 'resize'));
         $img_thumb = str_replace('/../../upload', 'http://' . F::sg('site', 'imageDomain'), $img_thumb);
         $img_thumb_now = CHtml::image($img_thumb, $this->title);
         return CHtml::link($img_thumb_now, $this->getUrl(), array('title' => $this->title));
     } else {
         return CHtml::link(CHtml::image($this->getHolderJs($width, $height)), $this->getUrl(), array('title' => $this->title));
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:19,代码来源:Item.php

示例7:

echo Yii::app()->baseUrl . '/';
?>
">首页>></a>
            <?php 
foreach ($this->breadcrumbs as $breadcrumb) {
    echo '<a href="' . $breadcrumb['url'] . '">' . $breadcrumb['name'] . '</a>';
}
?>
        </div>
        <div class="deal_pic">
            <div>
                <ul id="idNum" class="hdnum">
                    <?php 
foreach ($item->itemImgs as $itemImg) {
    if (!empty($itemImg->pic)) {
        $picUrl = $imageHelper->thumb('70', '70', $itemImg->pic);
        $picUrl = yii::app()->baseUrl . $picUrl;
    } else {
        $picUrl = $item->getHolderJs('70', '70');
    }
    echo '<li><img src="' . $picUrl . '" width="70" height="70"></li>';
}
?>
                </ul>
            </div>
            <div style="width: 450px; height: 450px; overflow: hidden; position: relative;" id="idTransformView" class="idtransformview">
                <ul id="idSlider" class="slider">
                    <?php 
foreach ($item->itemImgs as $itemImg) {
    if ($itemImg->pic) {
        $picUrl = $imageHelper->thumb('450', '450', $itemImg->pic);
开发者ID:lhfcainiao,项目名称:basic,代码行数:31,代码来源:view.php

示例8: array

                    <th class="col-xs-1">数量</th>
                    <th class="col-xs-1">小计</th>
                </tr>
                <?php 
$cart = Yii::app()->cart;
if (isset($item)) {
    $item->getId();
    if ($keys == null) {
        echo CHtml::hiddenField('sku_id', $item->sku->sku_id);
        echo CHtml::hiddenField('item_id', $item->sku->item_id);
        echo CHtml::hiddenField('quantity', $item->getQuantity());
    }
    ?>
                    <tr><?php 
    if ($item->getMainPic()) {
        $picUrl = $imageHelper->thumb('70', '70', $item->getMainPic());
        ?>
                        <td><?php 
        echo CHtml::image($picUrl, $item->title, array('width' => '80px', 'height' => '80px'));
    } else {
        echo Yii::t('leather', '该商品没有上传图片');
    }
    ?>
</td>
                        <td><?php 
    echo $item->title;
    ?>
</td>
                        <td><?php 
    echo empty($item->sku) ? '' : implode(';', json_decode($item->sku->props_name, true));
    ?>
开发者ID:lhfcainiao,项目名称:basic,代码行数:31,代码来源:checkout.php

示例9: array

         $img_thumb = Yii::app()->request->baseUrl . ImageHelper::thumb(150, 150, $img, array('method' => 'resize'));
         $img_thumb_now = CHtml::image($img_thumb, $this->item_name);
         return CHtml::link($img_thumb_now, array('/item/view', 'id' => $this->id));
     } else {
         return 'No Pic';
     }
 }
 public function getSmallThumb()
 {
     $img = '/upload/item/' . $this->item_image;
     $trueimage = 'http://wcydboss.com' . $img;
     if (F::isfile($trueimage)) {
开发者ID:rainsongsky,项目名称:yincart,代码行数:12,代码来源:Item1.php

示例10: getRecommendThumb

 public function getRecommendThumb()
 {
     $img = '/upload/item/' . $this->pic_url;
     $trueimage = Yii::app()->request->hostInfo . $img;
     if (F::isfile($trueimage)) {
         $img_thumb = Yii::app()->request->baseUrl . ImageHelper::thumb(80, 80, $img, array('method' => 'resize'));
         $img_thumb_now = CHtml::image($img_thumb, $this->title);
         return CHtml::link($img_thumb_now, array('/item/view', 'id' => $this->item_id), array('title' => $this->title));
     } else {
         return '没有图片';
     }
 }
开发者ID:rainsongsky,项目名称:yincart,代码行数:12,代码来源:Item.php

示例11: foreach

">更多新品>></a></div>
                    <div class="product_ca">
                        <div class="product_list_ca">
                            <?php 
        foreach ($items as $newItem) {
            $itemUrl = Yii::app()->createUrl('item/view', array('id' => $newItem->item_id));
            ?>
                                <div class="product_e">
                                    <div class="product_img"><a href="<?php 
            echo $itemUrl;
            ?>
">
                                            <?php 
            if ($newItem->getMainPic()) {
                $image = new ImageHelper();
                $picUrl = $image->thumb('220', '220', $newItem->getMainPic());
                $picUrl = Yii::app()->baseUrl . $picUrl;
            } else {
                $picUrl = $newItem->getHolderJs('220', '220');
            }
            ?>
                                            <img alt="<?php 
            echo $newItem->title;
            ?>
" src="<?php 
            echo $picUrl;
            ?>
"
                                                 width="220" height="220"></a>
                                    </div>
                                    <div class="product_name">
开发者ID:lhfcainiao,项目名称:basic,代码行数:31,代码来源:index.php

示例12: array

<br/>
<div class="row">
    <div class="span2">
        <?
        $avatar_size = array('width' => 170, 'height' => 100);
        $avatar = ImageHelper::thumb(User::PHOTO_PATH, $model->photo, $avatar_size, true);
        echo $avatar->isRealImage() ? $avatar : ImageHelper::placeholder($avatar_size);
        ?>
    </div>
    <div class="span3">
        <table class="table table-bordered table-striped">
            <tbody>
            <? if ($model->name) { ?>
                <tr>
                    <td>Имя</td>
                    <td><?php 
echo $model->name;
?>
</td>
                </tr>
            <? } ?>
            <? if ($model->email) { ?>
                <tr>
                    <td>Email</td>
                    <td><?php 
echo $model->email;
?>
</td>
                </tr>
            <? } ?>
            </tbody>
开发者ID:nizsheanez,项目名称:kur.ru,代码行数:31,代码来源:view.php

示例13: getRecentThumb

 /**
  * 得到最近商品缩略图
  * @return type
  */
 public function getRecentThumb()
 {
     $img = $this->getMainPicPath();
     if (file_exists(dirname(F::basePath()) . $img)) {
         $img_thumb = F::baseUrl() . ImageHelper::thumb(210, 210, $img, array('method' => 'resize'));
         $img_thumb_now = CHtml::image($img_thumb, $this->title);
         return CHtml::link($img_thumb_now, array('/item/view', 'id' => $this->item_id), array('title' => $this->title));
     } else {
         return CHtml::link(CHtml::image($this->getHolderJs('210', '210')), $this->getUrl(), array('title' => $this->title));
     }
 }
开发者ID:yinhe,项目名称:yincart,代码行数:15,代码来源:Item.php

示例14: getChildsId

 public static function getChildsId($id)
 {
     $data = array();
     $ids = array();
     if (!is_array($id)) {
         $id = array($id);
     }
开发者ID:rainsongsky,项目名称:yincart,代码行数:7,代码来源:Category.php


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