本文整理汇总了PHP中Attachments::faceImg方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::faceImg方法的具体用法?PHP Attachments::faceImg怎么用?PHP Attachments::faceImg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachments
的用法示例。
在下文中一共展示了Attachments::faceImg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$tagid = zmf::val('tagid', 2);
$tagInfo = array();
$default = true;
if ($tagid) {
$tagInfo = Tags::getByIds($tagid);
if ($tagInfo) {
$default = false;
$tagInfo = $tagInfo[0];
$sql = "SELECT p.id,p.uid,p.title,p.faceimg,p.content,p.tagids,p.comments,p.favorite FROM {{posts}} p,{{tag_relation}} tr WHERE tr.tagid='{$tagid}' AND tr.classify='posts' AND tr.logid=p.id AND p.`status`=" . Posts::STATUS_PASSED . " ORDER BY p.cTime DESC";
}
}
if ($default) {
$sql = 'SELECT id,uid,title,faceimg,content,tagids,comments,favorite FROM {{posts}} WHERE `status`=1 ORDER BY cTime DESC';
}
Posts::getAll(array('sql' => $sql), $pages, $posts);
$size = '640';
if ($this->isMobile) {
$size = '240';
}
foreach ($posts as $k => $val) {
if ($val['tagids'] != '') {
$_tags = Tags::getByIds($val['tagids']);
$posts[$k]['tagids'] = $_tags;
}
$posts[$k]['faceimg'] = Attachments::faceImg($val, $size);
}
$this->pageTitle = '文章 - ' . zmf::config('sitename');
$this->selectNav = 'posts';
$data = array('posts' => $posts, 'tagInfo' => $tagInfo, 'pages' => $pages);
$this->render('/index/index', $data);
}
示例2: elseif
$_secondTitle = $data['title_en'] ? $data['title_en'] : $data['title_local'];
} elseif ($data['title_en'] != '') {
$_title = $data['title_en'];
$_secondTitle = $data['title_local'];
} else {
$_title = $data['title_local'];
}
$_address = '';
if ($data['address_cn'] != '') {
$_address = $data['address_cn'];
} elseif ($data['address_en'] != '') {
$_address = $data['address_en'];
} else {
$_address = $data['address_local'];
}
$faceimg = Attachments::faceImg($data, 170);
$url = array('position/view', 'id' => $data['id']);
?>
<div class="media poi-list"><?php
$this->renderPartial('/common/_faceimg', array('img' => $faceimg, 'title' => $_title, 'id' => $data['id'], 'acss' => 'media-object lazy', 'lcss' => 'media-left', 'classify' => $data['classify'], 'width' => 170, 'url' => $url));
?>
<div class="media-body"><h4 class="media-heading"><?php
echo CHtml::link(CHtml::encode($_title), array('position/view', 'id' => $data['id']));
?>
</h4><p class="color-grey"><?php
echo $_secondTitle;
?>
</p><p class="color-grey"><?php
echo CHtml::encode($_address);
if ($data['lat'] && $data['long']) {
echo CHtml::link('(地图)', array('position/map', 'id' => $data['id']), array('title' => $_title . '的地图'));
示例3: actionView
public function actionView($id)
{
$id = zmf::filterInput($id);
$info = $this->loadModel($id);
if ($info['redirect'] > 0) {
$this->redirect(array('position/view', 'id' => $info['redirect']));
}
$_title = '';
if ($info['title_cn'] != '') {
$_title = $info['title_cn'];
}
if ($info['title_en'] != '' && $_title != '') {
$_title .= '(' . $info['title_en'] . ')';
} elseif ($info['title_local'] && $_title != '') {
$_title .= '(' . $info['title_local'] . ')';
} elseif ($info['title_en'] != '') {
$_title .= $info['title_en'];
} else {
$_title .= $info['title_local'];
}
$_address = '';
if ($info['address_cn'] != '') {
$_address = $info['address_cn'];
} elseif ($info['address_en'] != '') {
$_address = $info['address_en'];
} else {
$_address = $info['address_local'];
}
if (!Yii::app()->user->isGuest) {
if (Favorites::checkFavored($id, 'poi')) {
$this->favorited = true;
}
$tipinfo = PoiPost::model()->findByAttributes(array('logid' => $id, 'uid' => Yii::app()->user->id), 'status=' . Posts::STATUS_PASSED);
if ($tipinfo) {
$this->tiped = $tipinfo;
}
}
$info->faceimg = Attachments::faceImg($info, 600);
//获取图片
$images = Attachments::model()->findAll(array('condition' => "logid=:id AND " . ($info['faceimg'] > 0 ? "id!=" . $info['faceimg'] . ' AND ' : '') . " classify='poi' AND status=" . Posts::STATUS_PASSED, 'select' => 'id,filePath,classify,cTime', 'limit' => 6, 'order' => 'favor DESC', 'params' => array(':id' => $id)));
$breads = array();
$breads[] = CHtml::link('目的地', array('position/index'));
if ($info['areaid']) {
$areaInfo = Area::model()->findByPk($info['areaid']);
if ($areaInfo) {
$breads[] = CHtml::link($areaInfo['title'], array('position/index', 'areaid' => $areaInfo['id']));
}
}
//获取购买地址
$buylinks = array();
if ($info['classify'] == Position::HOTEL) {
$buylinks = Buylink::getAll('poi', $info->id);
}
//更新访问统计
Posts::updateCount($id, 'Position');
$breads[] = $_title;
$this->pageTitle = $_title . ' - ' . zmf::config('sitename');
$this->pageDescription = '【' . $_title . '】位于' . $_address . ',' . zmf::subStr($info['content'], 200);
$this->render('view', array('info' => $info, 'type' => $type, 'breads' => $breads, 'buylinks' => $buylinks, 'images' => $images));
}