-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nuxt3] Support responsive image sizes/srcset for pixel-device-ratio
> 1 (HD and Retina screens, iPad, ..)
#618
Comments
As for a solution on how to extend <nuxt-img
src="/cat.png"
alt="(5) <nuxt-img> with sizes defined for 1x size & and prop `2x` to also have double pixel density srcset generated"
class="w-full"
width="1200"
height="630"
2x
sizes="sm:250px lg:500px"/> Alternatives ideas
|
Would you consider support for this to be added, any preference on which props to go for? How about adding following boolean props? Or would that make it too restricted? '2x': { type: Boolean, default: undefined },
'3x': { type: Boolean, default: undefined },
'4x': { type: Boolean, default: undefined }, like for image/src/runtime/components/_base.ts Line 21 in db0934c
Can I go ahead and create a PR? |
Astro uses |
This is a very common issue, and as suggested in the comments above a PR was already created by @SimonBackx Thanks for diving into this @hartmut-co-uk, I really hope this will give the extra push it needs. |
This is a good solution, the current
Even better would be giving the option to globally define transform widths in the module config, and the Generating specific transform URLs based on the expected widths of every unique image element across an app makes no sense, and defeats the point of
|
On the second part I don't agree. Requirements can be very different, the render/display size. Of course, |
Yeah that is fair, would be good to have the option for both, quick and easy global transforms or more granular, separate controls for transforms and display sizes. |
This would be extremely valuable to us as well. Subscribing to notifications. Thanks for all the work! |
。。。 |
img.png |
I've got a similar issue with DPI 2x, where I've got a full width image that is always 500px height. On mobile width 320px DPI 2x a 640x500 image is being selected by the browser from the srcset. This is an issue since the image aspect ratio is wrong. The DPI 1x image is 320x500 and the DPI 2x image needs to be 640x1000 rather than 640x500. Example NuxtPicture usage for fixed height 100% width
Output
|
I am a little confused, the live docs have chapters called densities:
But it looks to me like using the density settings are not yet working - and obviously, this issue is still open as well as this PR https://github.com/nuxt/image/pull/227/files So I assume, densities have not yet been implemented? Thanks! |
Hi everyone, with #769 a first step has been implemented - just as the docs say. So Note: Please don't consider the API stabilised until next RC/GA. Discussions are still ongoing - that's why I've kept the issue open. |
Feature Request
Support (nuxt3) nuxt/image with vercel provider for static app ->
nuxt generate
.Example Repo
https://github.com/hartmut-co-uk/nuxt3-image-pixel-device-ratio-2x-support
Context
Source: https://medium.com/@woutervanderzee/responsive-images-with-srcset-and-sizes-fc434845e948
Demo
Hosted on vercel: https://nuxt3-image-pixel-device-ratio-2x-support.vercel.app/
PageSpeed Insights
Lighthouse Scan: https://pagespeed.web.dev/report?url=https%3A%2F%2Fnuxt3-image-pixel-device-ratio-2x-support.vercel.app%2F&form_factor=desktop
Conclusion
I'd like nuxt/image to somehow allow
srcset
to be created which includes pixel-device-ratio 2x (maybe others, too?) such as the manually coded option (4) which includes srcset options for [250w, 500w, 1000w].This is the only solution which provides both
on all devices.
Rendered as
sizes
is correct or if it's going to be ignored by the browser anyway - cause the browser chooses from srcset for the best choice consideringpixel-device-ratio
?!?...happy to be put right by someone with more insight!
The text was updated successfully, but these errors were encountered: