Cloudinary fit values: Width/Height attributes when using fit="fit" don't use actual outcome for Width/Height
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 331
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 9
Description
The Nuxt-Img docs are missing fit="fit". fit="fit" is the same as what Nuxt-Img calls fit="contain".
https://image.nuxtjs.org/providers/cloudinary#cloudinary-fit-values
https://image.nuxtjs.org/components/nuxt-img#fit
When you use fit="contain" with your provider set to Cloudinary, you do not get the expected outcome.
When using fit="fit" you want to either have a max height or width for the image, preserving aspect ratio. This means for the example below that a portrait image will have 500px in height and unknown width - and vice-versa for landscape.
<nuxt-img
provider="cloudinary"
fit="fit"
:src="imgUrl"
:height="500"
:width="500"
/>
However, the rendered image gets both attributes set, like so:
<img
src="https://res.cloudinary.com/xyz/image/upload/f_auto,q_auto,w_500,h_500,c_fit/xyz/img.jpg"
width="500"
height="500"
/>
Therefore, the browser gets wrong information about how to render the image on the screen.
Would there be a way to get this right without having the image aspect ratio beforehand?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Cloudinary fit values and Nuxt-Img fit documentation linked in the issue, then reproduce the provided example with portrait and landscape images. Done means the rendered image dimensions and HTML attributes reflect the actual contain/fit outcome without requiring a known aspect ratio beforehand.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100