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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

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

Started by Neil 4 years ago · 0 replies · 466 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 Thomas, 1 week ago
2 60 16 hours ago
Support · by Anna, 3 days ago
2 66 19 hours ago
Support · by Justin Young, 20 hours ago
1 34 20 hours ago
Support · by Duc , 1 week ago
2 70 6 days ago
Support · by Colin Hume, 1 week ago
2 61 6 days ago