V1.7 Product image CDN updater module prestashop

Marciano

Well-known member
Elite
XNullUser
Joined
Apr 14, 2021
Messages
32
Reaction score
396
Points
53
NullCash
267
This module can update image to CDN, your server only need one origin image. no need resize other small image.
we1.png
1、Modify src/Adapter/Product/ProductDataProvider.php
Find function name public function getImage($id_image)

Change:

`'base_image_url' => _THEME_PROD_DIR_ . $imageData->getImgPath(),`
to:

'base_image_url' => '//' . \Configuration::get('ETCLOUDIMAGE_ACCOUNT_DOMAIN') . '/v7/' . $imageData->getImgPath() . '.jpg?w=98&h=98p=',

img
we2.png
2、Modify src/Adapter/Image/ImageRetriever.php
Find function name public function getImage($object, $id_image)

Remove

$resizedImagePath = implode(DIRECTORY_SEPARATOR, [
$imageFolderPath,

$id_image . '-' . $image_type['name'] . '.' . $ext,
]);
if (!file_exists($resizedImagePath)) {
ImageManager::resize(
$mainImagePath,
$resizedImagePath,
(int) $image_type['width'],
(int) $image_type['height']
);
}
img
we3.png

3、Add Origin prefix
img

we4.png
4、Add image type
we5.png

5、Delete small image
 

Attachments

  • image-CDN-updater.zip
    1.4 MB · Views: 4

d-shilko

Well-known member
☆☆ Special ☆☆
☆ Pro ☆
Joined
Jun 10, 2021
Messages
2,596
Reaction score
1,698
Points
113
NullCash
1,307
Can you provide link of module page, and version?!
 

Sillumin

Well-known member
☆ Pro ☆
Master
Diamond
Elite
Joined
Jun 18, 2021
Messages
3,620
Reaction score
788
Points
113
NullCash
6,268
Thank you very much! It can be useful module!
 
Top