</div>
- <div class="col-md-5">
- <div class="row w-100 w-md-75 w-lg-50">
- <?php $model = new BouquetComposition(); ?>
- <div class="row mb-2"><?= Html::label("Фото", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
- <?= $form->field($model, 'photo_bouquet[]')->widget(FileInput::class, [
+ <div class="row">
+ <div class="col-md-6 w-100 w-md-75 w-lg-50">
+ <div class="row mb-2"><?= Html::label("Презентация", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
+ <?= $form->field($model, 'video_presentation')->widget(FileInput::class, [
'options' => [
- 'id' => 'bouquet-file-upload',
- 'multiple' => true, // Поддержка выбора нескольких файлов
- 'accept' => 'image/png, image/jpeg, image/jpg',
+ 'id' => 'video-file-upload',
+ 'multiple' => false,
+ 'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
],
'language' => 'ru',
'pluginOptions' => [
- 'initialPreview' => $photoUrls,
- 'initialPreviewConfig' => $photoConfig,
- 'initialPreviewAsData' => true,
'showPreview' => true,
'showUpload' => false,
'showCancel' => false,
- 'removeLabel' => '',
'mainClass' => 'input-group-lg',
- 'maxFileSize' => 2800, // Максимальный размер файла (в килобайтах)
- 'dropZoneTitle' => 'Выберите изображение', // Текст на зоне для перетаскивания
- 'browseOnZoneClick' => true, // Разрешить клик по зоне перетаскивания
+ 'initialPreview' => !empty($videoUrls) ? [
+ Html::tag('video', '', [
+ 'src' => is_array($videoUrls) ? $videoUrls[0] : $videoUrls, // Извлекаем первый элемент, если массив
+ 'controls' => true,
+ 'class' => 'file-preview-video',
+ 'style' => 'max-width: 100%; height: auto;'
+ ])
+ ] : [],
+ 'initialPreviewAsData' => false,
+ 'initialPreviewConfig' => !empty($videoUrls) ? [
+ ['type' => 'video', 'filetype' => 'video/mp4']
+ ] : [],
+ 'maxFileSize' => 100000,
+ 'dropZoneTitle' => 'Выберите видеофайл',
+ 'browseOnZoneClick' => true,
'fileActionSettings' => [
'showZoom' => false,
],
],
])->label(false) ?>
</div>
- <div class="row">
- <div class="col-md-6 w-100 w-md-75 w-lg-50">
- <div class="row mb-2"><?= Html::label("Презентация", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
- <?= $form->field($model, 'video_presentation')->widget(FileInput::class, [
- 'options' => [
- 'id' => 'video-file-upload',
- 'multiple' => false,
- 'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
- ],
- 'language' => 'ru',
- 'pluginOptions' => [
- 'showPreview' => true,
- 'showUpload' => false,
- 'showCancel' => false,
- 'mainClass' => 'input-group-lg',
- 'initialPreview' => !empty($videoUrls) ? [
- Html::tag('video', '', [
- 'src' => $videoUrls,
- 'controls' => true,
- 'class' => 'file-preview-video',
- 'style' => 'max-width: 100%; height: auto;'
- ])
- ] : [],
- 'initialPreviewAsData' => false, // Указываем, что данные передаются как HTML
- 'initialPreviewConfig' => !empty($videoUrls) ? [
- ['type' => 'video', 'filetype' => 'video/mp4'] // Тип файла для превью
- ] : [],
- 'maxFileSize' => 100000, // Максимальный размер файла (в килобайтах)
- 'dropZoneTitle' => 'Выберите видеофайл',
- 'browseOnZoneClick' => true,
- 'fileActionSettings' => [
- 'showZoom' => false,
- ],
- ],
- ])->label(false) ?>
- </div>
- <div class="col-md-6 w-100 w-md-75 w-lg-50">
- <div class="row mb-2"><?= Html::label("Процесс сборки", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
- <?= $form->field($model, 'video_build_process')->widget(FileInput::class, [
- 'options' => [
- 'id' => 'presentation-file-upload',
- 'multiple' => false,
- 'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
- ],
- 'language' => 'ru',
- 'pluginOptions' => [
- 'showPreview' => true,
- 'showUpload' => false,
- 'showCancel' => false,
- 'mainClass' => 'input-group-lg',
- 'initialPreview' => !empty($processUrls) ? [
- Html::tag('video', '', [
- 'src' => $processUrls,
- 'controls' => true,
- 'class' => 'file-preview-video',
- 'style' => 'max-width: 100%; height: auto;'
- ])
- ] : [],
- 'initialPreviewAsData' => false,
- 'initialPreviewConfig' => !empty($processUrls) ? [
- ['type' => 'video', 'filetype' => 'video/mp4']
- ] : [],
- 'maxFileSize' => 100000,
- 'dropZoneTitle' => 'Выберите видеофайл',
- 'browseOnZoneClick' => true,
- 'fileActionSettings' => [
- 'showZoom' => false,
- ],
+ <div class="col-md-6 w-100 w-md-75 w-lg-50">
+ <div class="row mb-2"><?= Html::label("Процесс сборки", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
+ <?= $form->field($model, 'video_build_process')->widget(FileInput::class, [
+ 'options' => [
+ 'id' => 'presentation-file-upload',
+ 'multiple' => false,
+ 'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
+ ],
+ 'language' => 'ru',
+ 'pluginOptions' => [
+ 'showPreview' => true,
+ 'showUpload' => false,
+ 'showCancel' => false,
+ 'mainClass' => 'input-group-lg',
+ 'initialPreview' => !empty($processUrls) ? [
+ Html::tag('video', '', [
+ 'src' => is_array($processUrls) ? $processUrls[0] : $processUrls, // Извлекаем первый элемент, если массив
+ 'controls' => true,
+ 'class' => 'file-preview-video',
+ 'style' => 'max-width: 100%; height: auto;'
+ ])
+ ] : [],
+ 'initialPreviewAsData' => false,
+ 'initialPreviewConfig' => !empty($processUrls) ? [
+ ['type' => 'video', 'filetype' => 'video/mp4']
+ ] : [],
+ 'maxFileSize' => 100000,
+ 'dropZoneTitle' => 'Выберите видеофайл',
+ 'browseOnZoneClick' => true,
+ 'fileActionSettings' => [
+ 'showZoom' => false,
],
- ])->label(false) ?>
- </div>
+ ],
+ ])->label(false) ?>
</div>
</div>