1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use app\widgets\CropperjsWidget;
- use yii\web\View;
- /** @var yii\web\View $this */
- /** @var app\models\Authors $model */
- /** @var yii\widgets\ActiveForm $form */
- $this->title='Редактировать карточку '.$model->getProfile()->one()->name;
- $photo = "/".$obj::$story_dir."/".$model->id."_norm.jpg";
- if( file_exists( Yii::getAlias('@webroot').$photo ) ){
- $imageSrc = $photo."?r=".rand();
- }else{
- $imageSrc = '/img/e.gif';
- }
- ?>
- <style>
- #image {
- width: 420px;
- background: URL(/img/image.svg) no-repeat 50% 50%;
- background-size: contain;
- background-color: #fff;
- cursor: pointer;
- aspect-ratio: 1/1;
- background-size: 70%;
- }
- </style>
- <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>
- <div class="container-fluid authors-form">
- <div class="row">
- <div class="col-6 col-sm-6">
- <div class="input-group mb-3">
- <img id="image" class="img-circle elevation-2" src="<?=$imageSrc?>" onClick="$('#modal').modal('show');document.getElementById('inputImage').click();" >
- <? echo CropperjsWidget::widget(['image' => 'image', 'file' => 'User[photo]', 'post' => 'cropping', 'aspectRatio' => '1/1']); ?>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <div class="form-group">
- <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
- </div>
- </div>
- </div>
- </div>
- <?php ActiveForm::end(); ?>
|