I have issue in product images.

Right now products are loading from cache from the path like below.


This is leading to 404 error page.

But if we remove cache from the image url, the image is loading successfully.

like below one


This will load the image correctly,

So I am planning to change the image url like this in all the pages.

How can load the image without cache path in product list page and in detail pages.

Can anyone look into this and update me ideas.

Thanks in advance!!


you shoud have product collection.

// return array, you can choose what you want
$image = $product->getMediaGalleryImages();
  • may i know in which file i need to use the above code? – jafar pinjar Jun 10 at 7:47
  • @jafarpinjar you can inject \Magento\Catalog\Api\ProductRepositoryInterface and get product collection,then use the above code arbitrarily. – tokey Jun 10 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.