Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
413 stars 51 forks source link

Images that dont have predefined height #192

Closed joebentaylor1995 closed 6 months ago

joebentaylor1995 commented 6 months ago

What props to do you use if your image has a rough width estimate, responsively, but needs to be auto in height?

Cant use fill, as that fills the parent div, cant use set height as that will change responsively...

Niels-IO commented 6 months ago

Hi @joebentaylor1995,

would this work? https://nextjs.org/docs/pages/api-reference/components/image#responsive-image-with-aspect-ratio

Otherwise, can you wrap it with another div with your appropriate dimensioning so that you can use fill? (as that is the intended approach by Next.js)

joebentaylor1995 commented 6 months ago

Unfortunately not as the image will be supplied from the CMS and would be different ratios as and when the client changes the imageKind regards,JoeOn 20 Dec 2023, at 16:54, Niels @.***> wrote: Hi @joebentaylor1995, would this work? https://nextjs.org/docs/pages/api-reference/components/image#responsive-image-with-aspect-ratio Otherwise, can you wrap it with another div with your appropriate dimensioning so that you can use fill? (as that is the intended approach by Next.js)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

joebentaylor1995 commented 6 months ago

GatsbyJS image worked perfectly for this scenario

Niels-IO commented 6 months ago

How would you define the Next.js image component in a normal next.js application?

joebentaylor1995 commented 6 months ago

I’m not sure, I’m new to next and it’s one of the biggest disappointments for images I’ve ever seenKind regards,JoeOn 21 Dec 2023, at 14:41, Niels @.***> wrote: How would you define the Next.js image component in a normal next.js application?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Niels-IO commented 6 months ago

I think the best bet would be to wrap your image in another div and use the Next.js image component as it is intended.

joebentaylor1995 commented 6 months ago

Oh, that sucks.Can’t you just make the height allow “auto”Kind regards,JoeOn 21 Dec 2023, at 16:23, Niels @.***> wrote: I think the best bet would be to wrap your image in another div and use the Next.js image component as it is intended.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

joebentaylor1995 commented 6 months ago

The fact this is closed is such a poor way to deal with a request.