Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Responsive image feature makes images larger, not higher-resolution?

Started by Neil 4 years ago · 0 replies · 551 views
4 years ago

Hi there!

I've just started using the responsive images feature, which is very cool. However, the way it works does not really make sense to me.

To illustrate, let's say I have a high-resolution image that I want to display at a width of 500 px. Previously, I would have just uploaded a copy of the image downsized to 500 px horizontal resolution. Now that I'm using this feature, I instead upload a copy with 1500 px horizontal resolution named "[email protected]" and include it in the page content with ![](image.png).

The generates the following HTML, which causes the image to actually display at the full width of the viewport, up to the raw width of 1500 px.

TXT
<img src="...image.png" sizes="100vw" 
  srcset="[email protected] 1500w, ...image2x.png 1000w, ...image.png 500w">

What I want instead is this, which causes the images to always display at a width of 500px, but with higher pixel density if the display supports it:

TXT
<img src="...image.png" 
  srcset="[email protected] 3x, ...image2x.png 2x, ...image.png 1x">

Am I missing something about how the feature works?

Is there a way to get the outcome I want without manually having to add ?sizes=500px to the Markdown for every single image?

last edited 07/03/22 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Support · by Paul Hodges, 4 weeks ago
19 490 6 days ago
Support · by Lauw, 1 week ago
2 107 1 week ago
Support · by Anna, 3 weeks ago
4 429 1 week ago
Support · by gtx, 4 weeks ago
4 380 3 weeks ago
Support · by Anna, 1 month ago
9 487 4 weeks ago