How Shopware Handles Thumbnail Selection and Image URLs
When an image is uploaded to the Shopware Media folder and assigned to a CMS layout, the storefront may generate image URLs with dimensions that do not match the thumbnail sizes configured in the Media folder.
For example, a Media folder may have these thumbnail sizes configured:
- 400 × 400
- 800 × 800
- 1920 × 1920
However, the storefront HTML may contain:
srcset=”…605×768… 605w, …605×768… 605w, …315×400… 315w”
sizes=”605px”
This can make it appear that Shopware has not generated the configured thumbnails correctly.
Cause
Shopware’s configured thumbnail dimensions are maximum bounding boxes, not fixed output dimensions.
When Keep Aspect Ratio is enabled, Shopware preserves the original image’s proportions. The generated thumbnail is therefore scaled to fit within the configured dimensions.
Shopware also does not upscale an image beyond its original dimensions.
For example, consider a portrait image with an original size of 605 × 768 pixels.
| Configured size | Generated size | Reason |
| 400 × 400 | 315 × 400 | The image is scaled to fit within the 400 × 400 box while keeping its aspect ratio. |
| 800 × 800 | 605 × 768 | The original image is smaller than the configured 800 × 800 box, so Shopware does not upscale it. |
| 1920 × 1920 | 605 × 768 | The original image is smaller than the configured 1920 × 1920 box, so Shopware keeps the original dimensions. |
Therefore, URLs such as 315×400 and 605×768 are expected.
Why Does srcset Show These Dimensions?
Shopware’s srcset uses the actual generated image dimensions, rather than the configured thumbnail size labels.
For example:
srcset=”…605×768… 605w, …605×768… 605w, …315×400… 315w”
The 315w and 605w values represent the actual widths of the available images.
If multiple configured thumbnail sizes resolve to the same original image dimensions, the same image width may appear more than once in the srcset.
The sizes attribute can also reflect the actual image width stored in the media metadata.
For example:
sizes=”605px”
indicates that the available image has a width of 605 pixels.
Do You Need to Generate Thumbnails Manually?
No. You do not need to run:
| 1 | bin/console media:generate-thumbnails |
if the thumbnails were already generated when the image was uploaded.
Manual thumbnail generation is generally only required when:
- Thumbnail sizes were changed after the image was uploaded.
- Expected thumbnails are missing.
- Existing thumbnails need to be regenerated.
You can check whether the generated thumbnails exist in the media_thumbnail storage before regenerating them.
How to Get Larger Thumbnail Variants
If you need actual 800px or 1920px-wide image variants, upload a higher-resolution source image.
For a portrait image, the source image’s long edge should be large enough to support the required output size.
For example, to generate a true 1920px-wide portrait variant, the original image needs sufficient resolution to reach that size without upscaling.
Shopware will not enlarge a smaller source image just to match the configured thumbnail dimensions.
What Should You Expect?
Configured thumbnail sizes should be treated as maximum dimensions, not guaranteed output dimensions.
For a portrait image, the generated result may therefore look like
400 × 400 → 315 × 400
800 × 800 → 605 × 768
1920 × 1920 → 605 × 768
This is expected behaviour when aspect ratio preservation is enabled and the source image is smaller than the configured thumbnail sizes.
If the current image dimensions are sufficient for the storefront display, no changes are required.
Recent help desk articles
Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.

