{ | { | ||||
$file = $model->$champsFile; | $file = $model->$champsFile; | ||||
if ($file) { | if ($file) { | ||||
$file_name = $file->baseName . '-' . uniqid(); | |||||
$file_name = str_replace(' ', '-', $file->baseName) . '-' . uniqid(); | |||||
$file_name_extension = $file_name . '.' . $file->extension; | $file_name_extension = $file_name . '.' . $file->extension; | ||||
$dir_file = '../../producer/web/uploads/'; | $dir_file = '../../producer/web/uploads/'; | ||||
$path_file = $dir_file . $file_name_extension; | $path_file = $dir_file . $file_name_extension; |
<?php $hasLogo = strlen($producer->logo) && Image::isPhotoExist($producer->logo); ?> | <?php $hasLogo = strlen($producer->logo) && Image::isPhotoExist($producer->logo); ?> | ||||
<div id="header" class="<?= $hasLogo ? 'with-logo' : 'without-logo'; ?>"> | <div id="header" class="<?= $hasLogo ? 'with-logo' : 'without-logo'; ?>"> | ||||
<?php if (strlen($producer->photo) || strlen($producer->logo)): ?> | <?php if (strlen($producer->photo) || strlen($producer->logo)): ?> | ||||
<div id="banner" style="background-color: <?= $mainColor ?>;<?php if(strlen($producer->photo)): ?>background-image:url(<?= \Yii::$app->urlManager->baseUrl; ?>/uploads/<?= $producer->photo; ?>);<?php endif; ?>"> | |||||
<div id="banner" style="background-color: <?= $mainColor ?>;<?php if(strlen($producer->photo)): ?>background-image:url(<?= \Yii::$app->urlManager->baseUrl; ?>/uploads/<?= urlencode($producer->photo); ?>);<?php endif; ?>"> | |||||
</div> | </div> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<?php if ($hasLogo): ?> | <?php if ($hasLogo): ?> |