Skip to content

Commit 8b1fede

Browse files
committed
MAGETWO-58792: [Backport] [Performance] Image resize mechanism does not generate images of all necessary sizes - 2.0
1 parent 54d4e70 commit 8b1fede

File tree

20 files changed

+1186
-234
lines changed

20 files changed

+1186
-234
lines changed

app/code/Magento/Catalog/Block/Product/View/Gallery.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,13 @@ public function getGalleryImages()
6363
);
6464
$image->setData(
6565
'medium_image_url',
66-
$this->_imageHelper->init($product, 'product_page_image_medium')
67-
->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)
66+
$this->_imageHelper->init($product, 'product_page_image_medium_no_frame')
6867
->setImageFile($image->getFile())
6968
->getUrl()
7069
);
7170
$image->setData(
7271
'large_image_url',
73-
$this->_imageHelper->init($product, 'product_page_image_large')
74-
->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)
72+
$this->_imageHelper->init($product, 'product_page_image_large_no_frame')
7573
->setImageFile($image->getFile())
7674
->getUrl()
7775
);

app/code/Magento/Catalog/Helper/Image.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,28 +241,29 @@ protected function setWatermarkProperties()
241241
{
242242
$this->setWatermark(
243243
$this->scopeConfig->getValue(
244-
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_image",
244+
"design/watermark/{$this->getType()}_image",
245245
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
246246
)
247247
);
248248
$this->setWatermarkImageOpacity(
249249
$this->scopeConfig->getValue(
250-
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity",
250+
"design/watermark/{$this->getType()}_imageOpacity",
251251
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
252252
)
253253
);
254254
$this->setWatermarkPosition(
255255
$this->scopeConfig->getValue(
256-
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_position",
256+
"design/watermark/{$this->getType()}_position",
257257
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
258258
)
259259
);
260260
$this->setWatermarkSize(
261261
$this->scopeConfig->getValue(
262-
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_size",
262+
"design/watermark/{$this->getType()}_size",
263263
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
264264
)
265265
);
266+
266267
return $this;
267268
}
268269

@@ -496,14 +497,14 @@ protected function initBaseFile()
496497
*/
497498
protected function isScheduledActionsAllowed()
498499
{
500+
$isAllowed = true;
499501
$model = $this->_getModel();
500-
if ($model->isBaseFilePlaceholder()
501-
&& $model->getNewFile() === true
502-
|| $model->isCached()
503-
) {
504-
return false;
502+
503+
if ($model->isBaseFilePlaceholder() || $model->isCached()) {
504+
$isAllowed = false;
505505
}
506-
return true;
506+
507+
return $isAllowed;
507508
}
508509

509510
/**

0 commit comments

Comments
 (0)