img() public static method

Generates an image tag.
public static img ( array | string $src, array $options = [] ) : string
$src array | string the image URL. This parameter will be processed by [[Url::to()]].
$options array the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
return string the generated image tag
Ejemplo n.º 1
0
<?php

use yii\bootstrap\Modal;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<div class="row image">
    <a data-index="0" id="us-upload" href="#upload" data-toggle="modal">
        <?php 
echo \yii\helpers\BaseHtml::img($image);
?>
    </a>
</div>  
<?php 
echo Html::activeTextInput($data->model, $data->attribute, $data->options);
?>

<?php 
Modal::begin(['header' => '<button type="button" id="button_close_picture" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                   <h4 class="modal-title"><i class="fa fa-picture-o"></i> Select Image</h4>', 'options' => ['id' => 'us-modal']]);
?>
<div class="wrap">
    <div id="step" class="subtitle_green">
        STEP 1: Choose Your Picture
    </div>

    <div id="step1">
        <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'action' => $data->controller]]);
echo Html::fileInput('us-file-upload', ['id' => 'us-file-upload']);
echo Html::hiddenInput('us-wsmall', $data->crop['wsmall']);