2

I need to get the url of a product cached thumbnail image.
This is my code:

$appEmulation->startEnvironmentEmulation($_POST['store_id'], \Magento\Framework\App\Area::AREA_FRONTEND, true);

$image = $helperImage->create()->init($product, 'product_thumbnail_image')
                    ->constrainOnly(TRUE)
                    ->keepAspectRatio(TRUE)
                    ->keepTransparency(TRUE)
                    ->keepFrame(FALSE)
                    ->resize(245,300);

$temp[] = $image->getUrl();

$appEmulation->stopEnvironmentEmulation();

The path I get is http://domain.com/pub/static/version1522319407/frontend/Vendor/theme_child/it_IT/Magento_Catalog/images/product/placeholder/thumbnail.jpg

How can I get the cached thumbnail image url?
Thanks in advance.

2
  • One tip I can give is that the Product Images Cache in pub/media/catalog/product/cache. I'll research more and give you feedback. Try : magento.stackexchange.com/questions/137057
    – Matt Silva
    Apr 12, 2019 at 18:12
  • I just tried your code and am getting a cached image. ‌https://domain.com/media/catalog/product/cache/thumbnail/400x400/e9c3970ab036de70892d86c6d221abfe/2/0/201305-efefef.jpg
    – Rooster242
    Jun 24, 2019 at 22:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.