本文整理汇总了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();
}
示例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);
}
示例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 '没有图片';
}
}
示例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
示例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));
}
}
示例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));
}
}
示例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);
示例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));
?>
示例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)) {
示例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 '没有图片';
}
}
示例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">
示例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>
示例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));
}
}
示例14: getChildsId
public static function getChildsId($id)
{
$data = array();
$ids = array();
if (!is_array($id)) {
$id = array($id);
}