How to force specific image size using sw_thumbnails directive

Hi Guys!

Does anyone know how to force the specific image size in the Shopware 6 theme? Storefront bases on the MediaEntity object and that always uses the original URL. If you check the template used with sw_thumbnails directive, ALWAYS the original MediaEntity URL is used. There is no option to force using e.g. thumbnail size there.

I know that Shopware generates srcset attribute automatically and it works well on smaller devices, but I just need to show the exact thumbnail size on all desktop sizes.

Someone can ask why I need to do that on desktop sizes. That’s simple. Just for optimisation purposes. Shopware forces me to load the original product image that e.g. has a 800x1200px resolution in the places (e.g. product boxes on archive pages that have 4 columns by default and such large size is not required there), that requires real size 200x200px even on the desktop! So Shopware by default doesn’t conform to optimisation rules provided by Google (https://web.dev/uses-responsive-images/).

I’ve also tried editing original Storefront files and force loading specific sizes by:
image
and
image
but it just don’t have any impact.

How can I just simply use sw_thumbnails with exact thumbnail size? Maybe there’s another Twig directive that is not documented or I can’t find the documentation for that?

I know that I can build my own solution, but I don’t want to do that. I don’t want to spend weeks updating overwritten theme templates after each small update…

Hello, any updates on this? We are looking for the solution here as well. Some thumbnails are too big for the layout.

Hello, any updates on this? We are looking for the solution here as well. Some thumbnails are too big for the layout.