本文整理汇总了PHP中StringHelper::generateUrlImage方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::generateUrlImage方法的具体用法?PHP StringHelper::generateUrlImage怎么用?PHP StringHelper::generateUrlImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringHelper
的用法示例。
在下文中一共展示了StringHelper::generateUrlImage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addComment
public function addComment($user_id, $post_id, $content)
{
$model = new Comments();
$model->post_id = $post_id;
$model->created_by = $user_id;
$model->updated_at = time();
$model->comment_content = $content;
$model->status = 1;
$model->created_at = time();
$model->updated_at = time();
$model->save(FALSE);
$post = Posts::model()->findByPk($post_id);
$post->post_comment_count++;
$user = User::model()->findByPk($model->created_by);
$user_commented = User::model()->findByPk($post->user_id);
if ($user_commented) {
if ($user->id != $post->user_id) {
$users_have_commented = $this->getListUserCommentedOnPost($post_id);
if ($users_have_commented) {
foreach ($users_have_commented as $item) {
if ($user_id != $item->created_by && $post->user_id != $item->created_by) {
$arr_noti_others = array('user_id' => $user->id, 'content' => "{$user->username} cũng đã bình luận bài viết của {$user_commented->username}", 'type' => 'comment_also', 'recipient_id' => $item->created_by, 'url' => Yii::app()->createAbsoluteUrl('post/viewPost', array('post_id' => $post_id, array('ref' => 'noti'))));
Notifications::model()->add($arr_noti_others);
}
}
}
$arr_noti = array('user_id' => $user->id, 'content' => "{$user->username} vừa bình luận bài viết của bạn", 'type' => 'comment', 'recipient_id' => $user_commented->id, 'url' => Yii::app()->createAbsoluteUrl('post/viewPost', array('post_id' => $post_id, array('ref' => 'noti'))));
Notifications::model()->add($arr_noti);
} else {
$users_have_commented = $this->getListUserCommentedOnPost($post_id);
if ($users_have_commented) {
foreach ($users_have_commented as $item) {
if ($user_id != $item->created_by) {
$arr_noti_others = array('user_id' => $user->id, 'content' => "{$user->username} cũng đã bình luận bài viết của họ", 'type' => 'comment_also', 'recipient_id' => $item->created_by, 'url' => Yii::app()->createAbsoluteUrl('post/viewPost', array('post_id' => $post_id, array('ref' => 'noti'))));
Notifications::model()->add($arr_noti_others);
}
}
}
}
}
if ($model->save(FALSE) && $post->save(FALSE)) {
$returnArr = array();
$returnArr['created_by'] = $model->created_by;
$returnArr['username'] = $user->username;
$returnArr['photo'] = StringHelper::generateUrlImage($user->photo);
$returnArr['created_at'] = Util::time_elapsed_string($model->created_at);
$returnArr['comment_content'] = $model->comment_content;
return $returnArr;
}
return FALSE;
}
示例2: getImagePreviewByPostId
public function getImagePreviewByPostId($post_id)
{
$criteria = new CDbCriteria();
$criteria->limit = 1;
$criteria->condition = "post_id = {$post_id}";
$data = Images::model()->find($criteria);
if ($data) {
$url = $data->img_url;
return StringHelper::generateUrlImage($url);
//Yii::app()->request->getBaseUrl(true) . '/' . $url;
} else {
return '';
}
}
示例3: url
<li class="notifi-item" noti-id="<?php
echo $data->id;
?>
" onclick="markSeen('<?php
echo $data->id;
?>
')">
<a href="<?php
echo $data->url;
?>
" class="notifi-link">
<?php
$user = User::model()->findByPk($data->user_id);
?>
<div class="image bg-cover" style="background-image: url('<?php
echo StringHelper::generateUrlImage($user->photo);
?>
');"></div>
<div class="content"><?php
echo $data->content;
?>
</div>
<div class="info">
<span class="icon"><i class="fa fa-heart notifi-like"></i></span>
<span class="date"><?php
echo date('d/m/Y', $data->created_at);
?>
</span>
</div>
</a>
示例4: array
<?php
}
?>
</a>
</div>
</div>
<div class="c-header">
<div class="user-image">
<?php
if (!empty($item['user_id'])) {
?>
<a href="<?php
echo Yii::app()->createUrl('user/profile', array('ref_web' => 'ref_web', 'user_id' => $item['user_id']));
?>
" class="user-avatar" style="background-image: url('<?php
echo StringHelper::generateUrlImage($item['user'][0]['photo']);
?>
');"></a>
<?php
}
?>
<?php
if (!empty($item['celeb_id'])) {
?>
<a href="<?php
echo Yii::app()->createUrl('user/profileCeleb', array('ref_web' => 'ref_web', 'celeb_id' => $item['celeb_id']));
?>
" class="user-avatar" style="background-image: url('<?php
echo '/' . $item['photo_celeb'];
?>
');"></a>
示例5: foreach
foreach ($data as $item) {
?>
<div class="card-single">
<div class="card-single-inner">
<div class="c-image">
<div class="post-image">
<img src="" alt="" class="hidden">
<a href="<?php
echo Yii::app()->createUrl('user/listPostAlbums', array('album_id' => $item['album_id']));
?>
" class="post-link album-link">
<?php
foreach ($item['images_preview'] as $image) {
?>
<div class="album-image bg-cover" style="background-image: url('<?php
echo StringHelper::generateUrlImage($image);
?>
');"></div>
<?php
}
?>
</a>
</div>
</div>
<div class="c-body">
<div class="album-info">
<span class="single-info">Album gồm <?php
echo $item['number_posts'];
?>
bài</span>
示例6: url
<div class="qh-user-page-header z-depth-1">
<div class="image-cover bg-cover" style="background-image: url('<?php
echo Yii::app()->theme->baseUrl;
?>
/assets/stock/cover1.jpg');">
<div class="cover-gradient"></div>
<div class="user-info">
<div class="avatar" style="background-image: url('<?php
echo StringHelper::generateUrlImage($profile->celeb_image);
?>
');"></div>
<div class="username"><?php
echo $profile->celeb_name;
?>
</div>
<div class="description">24 | HCMC | Fashionista | Vegatarian | Love Cats</div>
<?php
if ($is_followed == FALSE) {
?>
<div class="user-follow-btn">
<button class="qh-btn qh-btn-normal qh-btn-sm qh-btn-icon left-icon" id="follow" onclick="follow()"><i class="fa fa-user"></i>Theo dõi</button>
<!-- <button class="qh-btn qh-btn-normal qh-btn-sm qh-btn-icon left-icon"><i class="fa fa-check"></i>Đang theo dõi</button> -->
</div>
<?php
}
?>
<?php
if ($is_followed == TRUE) {
?>
<div class="user-follow-btn">
<button class="qh-btn qh-btn-normal qh-btn-sm qh-btn-icon left-icon" id="unfollow" onclick="unfollow()"><i class="fa fa-user"></i>Bỏ theo dõi</button>
示例7:
<label class="qh-form-label">Ảnh cover</label>
</div>
<div class="col-xs-10">
<div class="user-cover-upload" id="cover-reader">
<?php
if (empty($profile->cover)) {
?>
<img src="<?php
echo Yii::app()->theme->baseUrl;
?>
/assets/stock/cover1.jpg" alt="">
<?php
} else {
?>
<img src="<?php
echo StringHelper::generateUrlImage($profile->cover);
?>
" alt="">
<?php
}
?>
</div>
<input name="user_cover" type="file" id="inputCoverUpload" class="hidden"><label for="inputCoverUpload" class="qh-btn qh-btn-normal qh-btn-sm">Chọn ảnh</label>
</div>
</div>
<hr>
<div class="qh-form-row">
<div class="col-xs-10 col-xs-offset-2">
<button class="qh-btn qh-btn-red600" type="submit">Lưu thông tin</button>
</div>
</div>
示例8: foreach
<input id="post-id" name="post_id" type="hidden" value="<?php
echo $data['post_id'];
?>
" />
<span class="loading" id="loading-comment" style="display: none"><i class="fa fa-spinner fa-pulse"></i></span>
<button type="button" class="comment-post-submit qh-btn qh-btn-red600 qh-btn-sm" id="submit-comment" onclick="comment()">Đăng</button>
</div>
</form>
<div class="comment-list">
<ul class="list" id="list-comment">
<?php
foreach ($data['comments'] as $comment) {
?>
<li class="single-comment">
<div class="avatar" style="background-image: url('<?php
echo StringHelper::generateUrlImage($comment['photo']);
?>
');"></div>
<div class="user-name"><a href="<?php
echo Yii::app()->createUrl('user/profile', array('user_id' => $comment['created_by'], 'ref_web' => 'ref_web'));
?>
"><?php
echo $comment['username'];
?>
</a></div>
<div class="time"><?php
echo Util::time_elapsed_string($comment['created_at']);
?>
</div>
<?php
//echo $comment['created_at']
示例9: url
?>
/assets/stock/cover1.jpg');">
<?php
} else {
?>
<div class="image-cover bg-cover" style="background-image: url('<?php
echo Yii::app()->request->getBaseUrl(true) . '/' . $profile->cover;
?>
');">
<?php
}
?>
<div class="cover-gradient"></div>
<div class="user-info">
<div class="avatar" style="background-image: url('<?php
echo StringHelper::generateUrlImage($profile->photo);
?>
');"></div>
<div class="username"><?php
echo $profile->username;
?>
</div>
<?php
if (empty($profile->description)) {
?>
<div class="description">24 | HCMC | Fashionista | Vegatarian | Love Cats</div>
<?php
} else {
?>
<div class="description"><?php
echo $profile->description;
示例10: url
</div>
</li>
</ul>
</div>
<!-- <div class="login-btn">
<a href="#" class="facebook-login-btn qh-btn qh-btn-icon left-icon qh-btn-facebook qh-btn-md"><i class="fa fa-facebook"></i> Đăng nhập với Facebook</a>
</div> -->
<div class="user-nav">
<ul class="list">
<li class="user-profile-link">
<a href="<?php
echo Yii::app()->createUrl('user/profile');
?>
">
<div class="user-avatar bg-cover" style="background-image: url('<?php
echo StringHelper::generateUrlImage(Yii::app()->session['user_avatar']);
?>
');"></div>
<div class="user-name"><?php
echo Yii::app()->session['username'];
?>
</div>
</a>
</li>
<li>
<a href="#"><i class="fa fa-caret-down"></i></a>
<ul class="inner-list pull-right">
<li><a href="#">Về FitMe</a></li>
<li><a href="#">Điều khoản</a></li>
<li><a href="#">Bảo mật</a></li>
<li><a href="#">Quảng cáo</a></li>