Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

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

Started by Neil 4 years ago · 0 replies · 586 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 blu3prince, 4 days ago
1 78 12 hours ago
Support · by complanar, 7 days ago
6 162 2 days ago
Support · by Rick Beebe, 7 days ago
2 121 4 days ago
Support · by alex, 5 days ago
2 105 4 days ago
Support · by Marcel, 2 weeks ago
1 155 5 days ago