Skip to content

Commit 9a06ead

Browse files
committed
MAGETWO-89051: Absorb image optimization from 2.1 into 2.3
1 parent da7a64f commit 9a06ead

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

app/code/Magento/Catalog/Model/View/Asset/Image.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ private function getMiscPath()
184184
private function getImageInfo()
185185
{
186186
$path = $this->getModule()
187-
. DIRECTORY_SEPARATOR . $this->getSourceContentType()
188187
. DIRECTORY_SEPARATOR . $this->getMiscPath()
189188
. DIRECTORY_SEPARATOR . $this->getFilePath();
190189
return preg_replace('|\Q'. DIRECTORY_SEPARATOR . '\E+|', DIRECTORY_SEPARATOR, $path);

app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@ public function testGetPath($filePath, $miscParams)
118118
'miscParams' => $miscParams
119119
]
120120
);
121-
$imageType = $miscParams['image_type'] ?? 'image';
122121
$miscParams['background'] = isset($miscParams['background']) ? implode(',', $miscParams['background']) : '';
123122
$absolutePath = '/var/www/html/magento2ce/pub/media/catalog/product';
124123
$hashPath = md5(implode('_', $miscParams));
125124
$this->context->method('getPath')->willReturn($absolutePath);
126125
$this->encryptor->method('hash')->willReturn($hashPath);
127126
static::assertEquals(
128-
$absolutePath . '/cache/' . $imageType . '/' . $hashPath . $filePath,
127+
$absolutePath . '/cache/'. $hashPath . $filePath,
129128
$imageModel->getPath()
130129
);
131130
}
@@ -148,14 +147,13 @@ public function testGetUrl($filePath, $miscParams)
148147
'miscParams' => $miscParams
149148
]
150149
);
151-
$imageType = $miscParams['image_type'] ?? 'image';
152150
$miscParams['background'] = isset($miscParams['background']) ? implode(',', $miscParams['background']) : '';
153151
$absolutePath = 'http://localhost/pub/media/catalog/product';
154152
$hashPath = md5(implode('_', $miscParams));
155153
$this->context->expects(static::once())->method('getBaseUrl')->willReturn($absolutePath);
156154
$this->encryptor->expects(static::once())->method('hash')->willReturn($hashPath);
157155
static::assertEquals(
158-
$absolutePath . '/cache/' . $imageType . '/' . $hashPath . $filePath,
156+
$absolutePath . '/cache/' . $hashPath . $filePath,
159157
$imageModel->getUrl()
160158
);
161159
}

app/code/Magento/MediaStorage/App/Media.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,7 @@ public function launch()
172172

173173
private function setPlaceholderImage()
174174
{
175-
$exsistType = preg_match(
176-
'/thumbnail|small_image|swatch_image|swatch_thumb|image/',
177-
$this->relativeFileName,
178-
$matches
179-
);
180-
$imageType = $exsistType ? $matches[0] : 'image';
181-
182-
$placeholder = $this->placeholderFactory->create(['type' => $imageType]);
175+
$placeholder = $this->placeholderFactory->create(['type' => 'image']);
183176
$this->response->setFilePath($placeholder->getPath());
184177
}
185178

dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase
1717
/**
1818
* Base product image path
1919
*/
20-
const BASE_IMAGE_PATH = 'http://localhost/pub/media/catalog/product/cache/image/d2488fc0bc3ac9b3c170adf0d609e779';
20+
const BASE_IMAGE_PATH = 'http://localhost/pub/media/catalog/product/cache/8d4d2075b1a30681853bef5bdc41b164';
2121

2222
/**
2323
* Test getCollection None images

0 commit comments

Comments
 (0)