1

I am showing Listrak on site recommend product on my website.

Product images are very big, I need resizes images.

I have images name like 2/0/20mm.jpg and I am appeding it with https://example.com/media/catalog/product

So it will be

https://example.com/media/catalog/product/2/0/20mm.jpg

But i want

https://example.com/media/catalog/product/cache/fc6ca0131474e1299ecedb80f5002264/2/0/20mm.jpg

Note: I do not have product object, So can't load an get resized images that why need to get cache folder path so I will append image name.

Thanks in advance!

5
  • You can search magento code for the hash function which creates that hash and copy parts of it to your code
    – Alex
    Jul 24 '20 at 18:53
  • Are you trying to access the Magento images from and external website and don't know the URL? I believe the hash part is the same for same image resize settings, so you could hardcode it
    – Alex
    Jul 24 '20 at 19:14
  • @Alex, Yes I thought same to find hash code but could not find. at the moment I have written hard coded hash value but when I flush catalogue cache from admin, will hash value will change ?
    – Pawan
    Jul 25 '20 at 5:00
  • I think it shouldn't change. Only when you change the image format in the theme I guess
    – Alex
    Jul 25 '20 at 7:21
  • 1
    @Alex, Yes you are right, it is not changing hash after flush catalogue cache. we can hard code it. please add your comment as answer :)
    – Pawan
    Aug 5 '20 at 12:18
1

You can hard code the hash as it depends only on the image target format and mostly does not change.

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.