nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.35k stars 270 forks source link

nuxt-picture tag doesn't respect width and height props #908

Open MikeAltinget opened 1 year ago

MikeAltinget commented 1 year ago

We want to use NuxtPicture for serving webp images and falling back to jpg. However when setting the width and height attributes, the image is not resized properly.

Reproduction

The picture.vue file in this repo is a reproduction. Width and height is set to 500, however the requested image is 3072x3072.

Sadarex commented 1 year ago

Did you set sizes too? In case nothing is configured inside your picture tag, nuxt-image uses it's defaults: https://image.nuxtjs.org/configuration#screens

MikeAltinget commented 1 year ago

Did you set sizes too? In case nothing is configured inside your picture tag, nuxt-image uses it's defaults: https://image.nuxtjs.org/configuration#screens

No. I can't see anything in the docs about needing to set sizes for NuxtPicture. Maybe this is a docs issue?

However I do think it would be more intuitive just to set the width and height. I don't need the image to be responsive, but I would like to serve a webp format in supported browsers

goodpixels commented 1 year ago

Exactly the same problem here.

rvalenta4 commented 1 year ago

I am facing the same issue. Is that expected behavior?