Commit 1b9687f3fddab2cd4b5903cc9285ba0d0a5e2170

Authored by Karnovsky A
1 parent 1ee0d271

All resizer

backend/controllers/BrandController.php
... ... @@ -85,7 +85,7 @@ class BrandController extends Controller
85 85 $model->image = $image->name;
86 86 }
87 87 if ($model->save() && $image) {
88   - $image->saveAs(Yii::getAlias('@frontend/web/images/brand/' . $image->name));
  88 + $image->saveAs(Yii::getAlias('@storage/brand/' . $image->name));
89 89 }
90 90  
91 91 return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->brand_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams));
... ... @@ -110,7 +110,7 @@ class BrandController extends Controller
110 110 $model->image = $image->name;
111 111 }
112 112 if ($model->save() && $image) {
113   - $image->saveAs(Yii::getAlias('@frontend/web/images/brand/' . $image->name));
  113 + $image->saveAs(Yii::getAlias('@storage/brand/' . $image->name));
114 114 }
115 115  
116 116 return $this->redirect(['view', 'id' => $model->brand_id]);
... ...
backend/controllers/CategoryController.php
... ... @@ -88,7 +88,7 @@ class CategoryController extends Controller
88 88 $model->image = $image->name;
89 89 }
90 90 if ($model->save() && $image) {
91   - $image->saveAs(Yii::getAlias('@frontend/web/images/category/' . $image->name));
  91 + $image->saveAs(Yii::getAlias('@storage/category/' . $image->name));
92 92 }
93 93  
94 94 return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->category_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams));
... ... @@ -118,7 +118,7 @@ class CategoryController extends Controller
118 118 $model->image = $image->name;
119 119 }
120 120 if ($model->save() && $image) {
121   - $image->saveAs(Yii::getAlias('@frontend/web/images/category/' . $image->name));
  121 + $image->saveAs(Yii::getAlias('@storage/category/' . $image->name));
122 122 }
123 123  
124 124 return $this->redirect(['view', 'id' => $model->category_id]);
... ...
common/modules/product/models/Category.php
... ... @@ -195,7 +195,7 @@ class Category extends \yii\db\ActiveRecord
195 195 public function getImageUrl()
196 196 {
197 197 // return a default image placeholder if your source image is not found
198   - return isset($this->image) ? '/images/category/'. $this->image : '/images/no_photo.png';
  198 + return isset($this->image) ? '/storage/category/'. $this->image : '/storage/no_photo.png';
199 199 }
200 200  
201 201  
... ...
common/modules/product/models/Product.php
... ... @@ -242,12 +242,12 @@ class Product extends \yii\db\ActiveRecord
242 242 foreach ($this->imagesUpload as $image) {
243 243 $imageName = $image->baseName .'.'. $image->extension;
244 244 $i = 0;
245   - while(file_exists(Yii::getAlias('@frontend/web/images/products/' . $imageName))) {
  245 + while(file_exists(Yii::getAlias('@storage/products/' . $imageName))) {
246 246 $i++;
247 247 $imageName = $image->baseName .'_'. $i .'.'. $image->extension;
248 248 }
249 249  
250   - $image->saveAs(Yii::getAlias('@frontend/web/images/products/' .$imageName));
  250 + $image->saveAs(Yii::getAlias('@storage/products/' .$imageName));
251 251 $images[] = $imageName;
252 252 }
253 253 return $images;
... ... @@ -259,7 +259,7 @@ class Product extends \yii\db\ActiveRecord
259 259 public function getImageUrl()
260 260 {
261 261 $image = empty($this->variant) ? null : $this->variant->image;
262   - return !empty($image) ? $image->imageUrl : '/images/no_photo.png';
  262 + return !empty($image) ? $image->imageUrl : '/storage/no_photo.png';
263 263 }
264 264  
265 265 public function getImagesHTML() {
... ...
common/modules/product/models/ProductImage.php
... ... @@ -97,7 +97,7 @@ class ProductImage extends \yii\db\ActiveRecord
97 97 */
98 98 public function getImageFile()
99 99 {
100   - return isset($this->image) ? '/images/products/' . $this->image : null;
  100 + return isset($this->image) ? '/storage/products/' . $this->image : null;
101 101 }
102 102  
103 103 /**
... ... @@ -107,7 +107,7 @@ class ProductImage extends \yii\db\ActiveRecord
107 107 public function getImageUrl()
108 108 {
109 109 // return a default image placeholder if your source image is not found
110   - return isset($this->image) ? '/images/products/'. $this->image : '/images/no_photo.png';
  110 + return isset($this->image) ? '/storage/products/'. $this->image : '/storage/no_photo.png';
111 111 }
112 112  
113 113 /**
... ...
common/modules/product/models/ProductVariant.php
... ... @@ -97,7 +97,7 @@ class ProductVariant extends \yii\db\ActiveRecord
97 97 public function getImageUrl()
98 98 {
99 99 // return a default image placeholder if your source image is not found
100   - return !empty($this->image) ? $this->image->imageUrl : '/images/no_photo.png';
  100 + return !empty($this->image) ? $this->image->imageUrl : '/storage/no_photo.png';
101 101 }
102 102  
103 103 /**
... ...
common/modules/product/widgets/views/product_smart.php
... ... @@ -55,7 +55,7 @@ use yii\helpers\Url;
55 55 'catalog/product',
56 56 'product' => $product,
57 57 '#' => 'm' . $variant->product_variant_id]) ?>">
58   - <?= \common\components\artboximage\ArtboxImageHelper::getImage((!empty($variant->image) && !empty($variant->image->imageUrl) ? $variant->image->imageUrl : '/images/no_photo.png'), 'product_variant')?>
  58 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?>
59 59 </a>
60 60 </li>
61 61 <?php endforeach; ?>
... ...
common/modules/product/widgets/views/products_block.php
... ... @@ -17,11 +17,7 @@ use yii\web\View;
17 17 <?php endif?>
18 18 <a href="#" class="item_link">
19 19 <div class="pic">
20   - <?php if (empty($product->image)) :?>
21   - <img src="/images/no_photo.png">
22   - <?php else :?>
23   - <?= ArtboxImageHelper::getImage($product->image->imageUrl, 'product_list')?>
24   - <?php endif?>
  20 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'product_list')?>
25 21 </div>
26 22 <div class="title_item"><?= $product->name?></div>
27 23 </a>
... ...
common/modules/product/widgets/views/submenu.php
... ... @@ -9,11 +9,7 @@
9 9 <?php foreach($populary as $_item) :?>
10 10 <div class="content_item"><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $_item])?>">
11 11 <div valign="top" class="picture">
12   - <?php if (empty($_item->image)) :?>
13   - <img valign="top" src="/images/no_photo.png">
14   - <?php else :?>
15   - <?= $_item->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item->imageUrl, 'mainmenu') : ''?>
16   - <?php endif?>
  12 + <?= $_item->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item->imageUrl, 'mainmenu') : ''?>
17 13 </div>
18 14 <div class="title"><?= $_item->categoryName->value?></div>
19 15 </a></div>
... ... @@ -31,11 +27,7 @@
31 27 <?php foreach($item['children'] as $_item) :?>
32 28 <div class="content_item"><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $_item['item']])?>">
33 29 <div valign="top" class="picture">
34   - <?php if (empty($_item['item']->image)) :?>
35   - <img valign="top" src="/images/no_photo.png">
36   - <?php else :?>
37   - <?= $_item['item']->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item['item']->imageUrl, 'mainmenu') : ''?>
38   - <?php endif?>
  30 + <?= $_item['item']->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($_item['item']->imageUrl, 'mainmenu') : ''?>
39 31 </div>
40 32 <div class="title"><?= $_item['item']->categoryName->value?></div>
41 33 </a></div>
... ...
common/widgets/views/basket_modal.php
... ... @@ -17,7 +17,7 @@ use yii\helpers\Html;
17 17 <div class="delete_item_btn"><i class="fa fa-times"></i></div>
18 18 <div class="little_img">
19 19 <?php if (empty($item['item']->product->image)) :?>
20   - <img src="/images/no_photo.png">
  20 + <img src="/storage/no_photo.png">
21 21 <?php else :?>
22 22 <img src="<?= $item['item']->product->image->imageUrl?>" alt="<?= $item['item']->product->image->alt ? $item['item']->product->image->alt : $item['item']->product->name?>">
23 23 <?php endif?>
... ...
frontend/views/catalog/product.php
... ... @@ -21,16 +21,18 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
21 21 <div class="item_3_blocks_wrap" id="one_item_block" data-id="<?= $product->variant->product_variant_id?>"> <!-- flex container -->
22 22 <div class="item_img_block"> <!-- блок с фотографиями -->
23 23  
24   - <div class="fotorama" data-allowfullscreen="true" data-nav="thumbs">
25 24 <?php if (!empty($product->images)) :?>
  25 + <div class="fotorama" data-allowfullscreen="true" data-nav="thumbs">
26 26  
27 27 <?php foreach($product->images as $image) :?>
28 28 <a href="<?=$image->imageUrl ?>">
29 29 <?= ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb')?>
30 30 </a>
31 31 <?php endforeach?>
32   - <?php endif?>
33 32 </div>
  33 + <?php else :?>
  34 + <?= ArtboxImageHelper::getImage($product->imageUrl, 'product')?>
  35 + <?php endif?>
34 36 <div class="product_service">
35 37 <ul>
36 38 <li class="item1"><a id="add_to_bookmarks" href="#">Добавить в закладки</a>
... ... @@ -121,6 +123,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
121 123 </div>-->
122 124  
123 125 </div><!-- закрытие блока с характеристиками -->
  126 + <?php /*
124 127 <hr>
125 128  
126 129 <h1 class="with_this">С этим товаром покупают</h1>
... ... @@ -130,7 +133,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
130 133 <div class="my_custom_card">
131 134 <div class="new">АКЦИЯ</div>
132 135 <div class="top">Toп</div>
133   - <a href="#" class="item_link"><div class="pic"><img src="/images/no_photo.png"></div>
  136 + <a href="#" class="item_link"><div class="pic"><img src="/storage/no_photo.png"></div>
134 137 <div class="title_item">Штукатурка гипсовая Кнауф Ротбанд 30 кг белая</div></a>
135 138 <div class="brand">Бренд: <span>Knauf</span></div>
136 139 <div class="type">Штукатурки</div>
... ... @@ -143,7 +146,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
143 146 <div class="my_custom_card">
144 147 <div class="new">АКЦИЯ</div>
145 148 <div class="top">Toп</div>
146   - <a href="#" class="item_link"><div class="pic"><img src="/images/no_photo.png"></div>
  149 + <a href="#" class="item_link"><div class="pic"><img src="/storage/no_photo.png"></div>
147 150 <div class="title_item">Штукатурка гипсовая Кнауф Ротбанд 30 кг белая</div></a>
148 151 <div class="brand">Бренд: <span>Knauf</span></div>
149 152 <div class="type">Штукатурки</div>
... ... @@ -156,7 +159,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
156 159 <div class="my_custom_card">
157 160 <div class="new">АКЦИЯ</div>
158 161 <div class="top">Toп</div>
159   - <a href="#" class="item_link"><div class="pic"><img src="/images/no_photo.png"></div>
  162 + <a href="#" class="item_link"><div class="pic"><img src="/storage/no_photo.png"></div>
160 163 <div class="title_item">Штукатурка гипсовая Кнауф Ротбанд 30 кг белая</div></a>
161 164 <div class="brand">Бренд: <span>Knauf</span></div>
162 165 <div class="type">Штукатурки</div>
... ... @@ -169,7 +172,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
169 172 <div class="my_custom_card">
170 173 <div class="new">АКЦИЯ</div>
171 174 <div class="top">Toп</div>
172   - <a href="#" class="item_link"><div class="pic"><img src="/images/no_photo.png"></div>
  175 + <a href="#" class="item_link"><div class="pic"><img src="/storage/no_photo.png"></div>
173 176 <div class="title_item">Штукатурка гипсовая Кнауф Ротбанд 30 кг белая</div></a>
174 177 <div class="brand">Бренд: <span>Knauf</span></div>
175 178 <div class="type">Штукатурки</div>
... ... @@ -180,6 +183,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
180 183 </div>
181 184  
182 185 </div> <!-- конец блока - с этим также покупают -->
  186 + */?>
183 187 <div class="tabs_block"> <!-- Табы с описанием видео и отзывами -->
184 188 <div class="ionTabs" id="tabs_1" data-name="Tabs_Group_name">
185 189 <ul class="ionTabs__head">
... ...
frontend/views/catalog/product_item.php
... ... @@ -7,11 +7,7 @@ use common\components\artboximage\ArtboxImageHelper;
7 7 <div class="top">Toп</div>-->
8 8 <a href="<?= \yii\helpers\Url::to(['catalog/product', 'product' => $product])?>" class="item_link">
9 9 <div class="pic">
10   - <?php if (empty($product->image)) :?>
11   - <img src="/images/no_photo.png">
12   - <?php else :?>
13   - <?= ArtboxImageHelper::getImage($product->image->imageUrl, 'product_list')?>
14   - <?php endif?>
  10 + <?= ArtboxImageHelper::getImage($product->imageUrl, 'product_list')?>
15 11 </div>
16 12 <div class="title_item"><?= $product->name?></div></a>
17 13 <?php if (!empty($product->brand)) :?>
... ...
frontend/views/catalog/product_smart.php
... ... @@ -7,11 +7,7 @@ use common\components\artboximage\ArtboxImageHelper;
7 7 <div class="top">Toп</div>-->
8 8 <a href="<?= \yii\helpers\Url::to(['catalog/product', 'product' => $product])?>" class="item_link">
9 9 <div class="pic">
10   - <?php if (empty($product->image)) :?>
11   - <img src="/images/no_photo.png">
12   - <?php else :?>
13   - <?= ArtboxImageHelper::getImage($product->image->imageUrl, 'product_list')?>
14   - <?php endif?>
  10 + <?= ArtboxImageHelper::getImage($product->imageUrl, 'product_list')?>
15 11 </div>
16 12 <div class="title_item"><?= $product->name?></div></a>
17 13 <?php if ($product->brand) :?>
... ...
frontend/views/orders/basket-step-02.php
... ... @@ -25,7 +25,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
25 25 <div class="delete_item_btn"><i class="fa fa-times"></i></div>
26 26 <div class="little_img">
27 27 <?php if (empty($item['item']->product->image)) :?>
28   - <img src="/images/no_photo.png">
  28 + <img src="/storage/no_photo.png">
29 29 <?php else :?>
30 30 <img src="/images/<?= $item['item']->product->image->image?>" alt="<?= $item['item']->product->image->alt ? $item['item']->product->image->alt : $item['item']->product->name?>">
31 31 <?php endif?>
... ...