本文整理汇总了PHP中yii\bootstrap\Html::img方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::img方法的具体用法?PHP Html::img怎么用?PHP Html::img使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::img方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionImagine
public function actionImagine()
{
$product = ProductRecord::find()->lang()->one();
echo Html::img($product->image->source);
echo Html::img($product->imageSrc('200x200', \yii\image\drivers\Image::CROP));
echo Html::img($product->imageSrc('100x200', \yii\image\drivers\Image::CROP));
echo Html::img($product->imageSrc('500x200'));
}
示例2: render
/**
* @return string
*/
public function render()
{
if (isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = self::IMAGE_CLASS . ' ' . $this->htmlOptions['class'];
} else {
$this->htmlOptions['class'] = self::IMAGE_CLASS;
}
return \yii\bootstrap\Html::img($this->src, $this->htmlOptions);
}
示例3: actionIndex
/**
* Lists all Book models.
* @return mixed
*/
public function actionIndex($id = null)
{
Yii::$app->session->setFlash('redirectUrl', Yii::$app->request->url);
$searchModel = new BookSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
if (!empty($id)) {
$model = $this->findModel($id);
return $this->render('index', ['bookModel' => $model, 'imageResponse' => Html::img(Url::toRoute($model->imageUrl), ['style' => 'width:550px;']), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}
return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}
示例4: img
public static function img($src, $options = [], $encode = false, $webroot = '@webroot')
{
if ($encode === true) {
$file = Yii::getAlias($webroot) . DIRECTORY_SEPARATOR;
$file .= is_array($src) ? $src[0] : $src;
$data = file_get_contents($file);
if ($data !== false) {
$src = 'data:' . mime_content_type($file) . ';base64,' . base64_encode($data);
}
}
return parent::img($src, $options);
}
示例5:
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5><?php
echo Yii::t('common', 'Information');
?>
</h5>
</div>
<div class="ibox-content">
<?php
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
// Image
$imageConfig = ['options' => ['accept' => 'uploads/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => FALSE, 'showRemove' => FALSE, 'showUpload' => FALSE, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Photo', 'removeClass' => 'btn btn-danger', 'removeLabel' => "Delete", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>', 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'jpeg']]];
if (!empty($model->image)) {
$imageConfig['pluginOptions']['initialPreview'] = [Html::img(LetHelper::getFileUploaded($model->image), ['class' => 'file-preview-image'])];
}
// END Image
$tabs = [['label' => Yii::t('common', 'General information'), 'content' => $form->field($model, 'name')->textInput() . $form->field($model, 'class')->textInput() . $form->field($model, 'skin')->textInput() . $form->field($model, 'image')->widget(FileInput::classname(), $imageConfig) . $form->field($model, 'content')->widget(letyii\tinymce\Tinymce::className(), ['options' => ['style' => 'height: 400px;'], 'configs' => ['plugins' => 'moxiemanager advlist autolink lists link image charmap print preview hr anchor pagebreak ' . 'searchreplace wordcount visualblocks visualchars code fullscreen ' . 'insertdatetime media nonbreaking save table contextmenu directionality ' . 'emoticons template paste textcolor colorpicker textpattern', 'toolbar1' => 'insertfile undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 'toolbar2' => 'print preview media | forecolor backcolor emoticons', 'moxiemanager_image_settings' => ['moxiemanager_title' => 'Images', 'moxiemanager_extensions' => 'jpg,png,gif', 'moxiemanager_rootpath' => '/uploads/editor', 'moxiemanager_view' => 'thumbs'], 'external_plugins' => ['moxiemanager' => Url::base() . '/plugins/moxiemanager/plugin.min.js'], 'entity_encoding' => 'raw', 'force_p_newlines' => true, 'force_br_newlines' => false, 'auto_cleanup_word' => false, 'relative_urls' => true, 'convert_urls' => false, 'remove_script_host' => true, 'verify_html' => false, 'forced_root_block' => false, 'content_css' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', 'templates' => Url::to(['template'])]]) . $form->field($model, 'description')->textarea() . $form->field($model, 'promotion')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])) . $form->field($model, 'status')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])), 'active' => true], ['label' => 'Seo', 'content' => $form->field($model, 'slug')->textInput() . $form->field($model, 'slug_prefix')->textInput() . $form->field($model, 'seo_url')->textInput() . $form->field($model, 'seo_title')->textInput() . $form->field($model, 'seo_desc')->textInput(), $form->field($model, 'seo_keyword')->textInput()]];
echo Html::hiddenInput('save_type', 'save');
echo yii\bootstrap\Tabs::widget(['items' => $tabs]);
ActiveForm::end();
?>
</div>
</div>
</div>
</div>
</div>
示例6:
<?php
use app\modules\cms\models\WebPage;
use yii\bootstrap\Html;
use yii\helpers\Url;
/**
* @var WebPage $model
*/
if (!is_null($model->base->menu_index)) {
$upLink = Html::a(Html::img($this->assetManager->getBundle('app\\modules\\cms\\assets\\CmsAsset')->baseUrl . '/fleche-monter-verte-32.png'), Url::to(['/cms/base-pages/increase-menu-index/', 'id' => $model->base_id]));
$downLink = Html::a(Html::img($this->assetManager->getBundle('app\\modules\\cms\\assets\\CmsAsset')->baseUrl . '/fleche-descendre-verte-32.png'), Url::to(['/cms/base-pages/decrease-menu-index/', 'id' => $model->base_id]));
echo "{$upLink} {$downLink} [{$model->base->menu_index}] {$model->menu_title}";
} else {
echo '';
}
示例7:
<?php
use yii\bootstrap\Html;
use yii\helpers\Url;
echo Html::a(Html::img($post->photo), Url::to('/post/' . $post->id), ['class' => 'ad-image']) . Html::tag('div', Html::tag('span', Html::tag('div', \rmrevin\yii\fontawesome\FA::icon($post->categoryObject->image), ['style' => 'background-color: ' . $post->categoryObject->color, 'class' => 'category-icon-box']), ['class' => 'ad-category']) . Html::a($post->title, Url::to('/post/' . $post->id)) . Html::tag('div', Html::tag('span', $post->price), ['class' => 'add-price']), ['class' => 'ad-box-content']);
示例8: function
echo $model->airport->name;
?>
(<?php
echo $model->airport->icao;
?>
)</h1>
</div>
<div class="row">
<?php
echo \yii\bootstrap\Html::a('View ' . $actother . ' <i class="fa fa-forward"></i>', ['/booking/' . $actother, 'id' => $model->airport_id]);
?>
</div>
<div class='row'>
<?php
echo \yii\grid\GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-condensed'], 'layout' => '{items}', 'columns' => [['attribute' => 'airline', 'format' => 'html', 'header' => false, 'value' => function ($data) {
return \yii\bootstrap\Html::img('https://ivaoru.org/images/airlines/' . $data->airline . '.gif');
}], ['attribute' => 'flightnumber', 'format' => 'raw', 'value' => function ($data) {
$lnk = $data->turnaround_id ? "<i onclick='showturnaround({$data->id})' style='cursor: pointer;' class='fa fa-spin fa-refresh' title='This flight have turnaround'></i>" : "";
return $lnk . " " . $data->airline . $data->flightnumber;
}], 'gate', 'aircraft', 'icaofrom', 'icaoto', 'timefrom', 'timeto', ['header' => 'info', 'format' => 'html', 'value' => function ($data) {
if (!$data->vid) {
return \yii\helpers\Html::a('Book', \yii\helpers\Url::to(['/booking/book', 'id' => $data->id]), ['class' => 'btn btn-xs btn-success']);
}
return \yii\helpers\Html::a('Booked: ' . $data->vid, \yii\helpers\Url::to(['/booking/show', 'id' => $data->id]), ['class' => 'btn btn-xs btn-warning']);
}], ['visible' => !Yii::$app->user->isGuest && Yii::$app->user->identity->isadmin, 'class' => \yii\grid\ActionColumn::className(), 'header' => 'Admin', 'template' => '{turnaround} {delete}', 'buttons' => ['turnaround' => function ($url, $model, $key) {
if (!$model->turnaround_id) {
return "<i style='cursor: pointer' onclick='linkturnaround({$model->id})' title='link turnaround flights' class='fa fa-refresh'></i>";
} else {
return "<i style='cursor: pointer' onclick='unlinkturnaround({$model->id})' title='unlink turnaround flights' class='fa fa-unlink'></i>";
}
}]]]]);
示例9: foreach
ActiveForm::end();
?>
<div class="search-results">
<?php
if (is_array($results)) {
if (empty($results)) {
echo '<article>' . Yii::t('msg', 'No results') . '</article>';
} else {
foreach ($results as $group) {
?>
<article class="list-item">
<div class="row">
<div class="col-xs-12 col-sm-3">
<?php
echo $group->has_logo ? Html::img('/logo/' . $group->id . '.jpg', ['alt' => $group->name]) : '';
?>
</div>
<div class="col-xs-12 col-sm-6">
<h4><?php
echo $group->name;
?>
</h4>
<p class="text-blue"><?php
echo $group->short;
?>
</p>
<p class="hash-tags">
<?php
if ($group->tags) {
echo '#' . implode(' #', ArrayHelper::map($group->tags, 'id', 'name'));
示例10: isset
$this->title = Html::encode($page->model->name);
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Pages'), 'url' => ['/page/index']];
$this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => [Url::to()]];
?>
<div class="shop-page">
<div class="row">
<div class="col-md-12">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
</div>
<div class="col-md-12">
<h1>
<?php
echo $page->model->name;
?>
</h1>
<div class="thumbnail no-border">
<?php
echo Html::img($page->getImageUrl());
?>
</div>
<?php
echo $page->model->content;
?>
</div>
</div>
</div>
示例11:
</div>
</div>
<!--end gameserver-->
<!--recent articles-->
<div class="row">
<div class="col-md-12">
<div class="margin-bottom-50">
<div class="headline"><h3>最新资讯</h3></div>
<?php
foreach (Buuug7Util::getRecentArticles() as $article) {
?>
<div class="blog-thumb blog-thumb-circle">
<div class="blog-thumb-hover">
<?php
echo Html::img($article->thumbnail_base_url . '/' . $article->thumbnail_path, ['alt' => $article->title]);
?>
<a class="hover-grad" href=""><i class="fa fa-link"></i></a>
</div>
<div class="blog-thumb-desc">
<h3>
<a href="<?php
echo Url::to(['article/view', 'slug' => $article->slug]);
?>
"><?php
echo $article->title;
?>
</a>
</h3>
<ul class="blog-thumb-info">
<li><?php
示例12:
?>
<!-- MAIN -->
<main id="main" class="main-container">
<!-- SECTION 1 -->
<div class="section section-1">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="media avatar">
<div class="media-left">
<a href="<?php
echo Url::to(['/account/public-profile'], ['display_name' => $user->display_name]);
?>
">
<?php
echo Html::img(\app\helpers\LetHelper::getFileUploaded($user->image), ['class' => 'media-object', 'width' => '80', 'height' => '80']);
?>
</a>
</div>
<div class="media-body">
<h4 class="media-heading"><?php
echo Html::encode($user->userJob->getDisplayName());
?>
</h4>
</div>
</div>
<dl class="row information">
<dt class="col-xs-12 col-sm-4">Company Name:</dt>
<dd class="col-xs-12 col-sm-8"><?php
echo $user->userJob->agent_company_name ? Html::encode($user->userJob->agent_company_name) : Yii::t('common', 'Not set');
?>
示例13:
use app\helpers\CurrencyHelper;
use app\widgets\Rating;
use yii\bootstrap\Html;
use yii\helpers\Url;
/** @var ProductObject $product */
$url = Url::to(['product/view', 'slug' => $product->model->slug]);
?>
<div class="col-md-3">
<div class="thumbnail">
<a class="image" href="<?php
echo $url;
?>
">
<?php
echo Html::img($product->thumb(300, 300));
?>
</a>
<p class="caption">
<?php
echo Html::a($product->model->name, $url);
?>
</p>
<p class="price"><?php
echo CurrencyHelper::format($product->model->price);
?>
</p>
<div class="rating">
<?php
echo Rating::widget(['name' => "Product[{$product->model->id}]rating", 'value' => $product->model->rating, 'readonly' => true]);
?>
示例14:
<?php
use yii\bootstrap\Html;
use yii\helpers\Url;
?>
<div class="panel panel-default">
<div class="panel panel-heading">
<?php
echo $model->user->fullname;
?>
</div>
<div class="panel panel-body">
<div class="media">
<div class="media-left media-middle">
<a href="#">
<?php
echo Html::img($model->user->image);
?>
</a>
</div>
<div class="media-body">
Информация
</div>
</div>
</div>
</div>
示例15:
<?php
/**
* Created by PhpStorm.
* User: David Cocom
* Date: 14/02/2016
* Time: 03:39 PM
*/
use app\models\Person;
use yii\bootstrap\Html;
use yii\helpers\Url;
?>
<div class="row">
<div class="col-xs-2">
<?php
echo Html::img(Url::to(['/images/uady-logo.jpg']));
?>
</div>
<div class="col-xs-6 center-block">
<h4 class="text-center" style="font-weight: bold">Universidad Autónoma de Yucatán</h4>
<p class="text-center">Direccion General de Desarrollo Academico<br>Sistema de Atencion Integral al
Estudiante<br>Programa
Institucional de Servicio Social</p>
</div>
</div>
<h3 class="text-center" STYLE="font-weight: bold">CARTA DE ASIGNACIÓN</h3>
<div class="row">
<h4 class="text-center" style="margin: 2em 0">DATOS DEL PRESTADOR</h4>
<div class="col-xs-3 col-xs-offset-1">
<strong>Matricula:</strong><br>