Responsive image sizing
See original GitHub issueWe live in a time when websites should work on a huge range of devices with different sizes and densities, it is not enough to have only one version of image… at least 2 versions of each file (1x and 2x) is a must for modern web, but in many cases it may be reasonable to have 3-4 sizes of each file in webp format + fallback to jpg/png, so each picture usually may be resized/converted to 2-4-6 or more versions.
Problems:
- There is no way do define image sizes for high density image versions
- Presets do not allow to use
sizesproperty available fornuxt-img - (for @nuxt/content) Images inside .md files that included using .md syntax are not processed by @nuxt/image, it would be very nice if it is possible to set a default sizing using preset for those images
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How To Create Responsive Images - W3Schools
Responsive images will automatically adjust to fit the size of the screen. Resize the browser window to see the responsive effect:.
Read more >CSS Responsive Image Tutorial: How to Make Images ...
Making an image fluid, or responsive, is actually pretty simple. When you upload an image to your website, it has a default width...
Read more >Responsive images - Learn web development | MDN
In this article, we'll learn about the concept of responsive images — images that work well on devices with widely differing screen sizes, ......
Read more >Responsive images - web.dev
Sizing hints # ... If you know the dimensions of the image you should include width and height attributes. Even if the image...
Read more >Responsive Images Done Right: A Guide To <picture> And ...
The sizes attribute tells the browser how many pixels it needs by describing the final rendered width of our image. Think of sizes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @ArtCraft. Thanks for detailed proposal. Supporting densities, for sure makes sense. But I am thinking if main purpose is that, we can think about easier interface like this:
This way we can easily auto calculate all required additional densities and omit close variants. Also as you mentioned about preset, we can allow a global (
nuxt.config) option to specify required densities and remove need of specify it on each use case.What do you think about this?
for example
this generates following code
on retina display (device pixel ratio 2.0) optimal image sizes would be 400px and 1000px, but srcset attribute do not provide those sizes
what should be generated to look good is:
so there should be some way to define those sizes as well something like
almost like img tag but with skipped filenames in srcset which going to be filled in automatically