Skip to content

Conversation

Rich-Harris
Copy link
Member

i don't honestly recall what enhanced-image does in this scenario but i'm hoping it will generate lower resolution versions for smaller screens

Copy link

vercel bot commented Oct 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
omnisite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 10:29pm

@Rich-Harris
Copy link
Member Author

okay looks like i need to specify different widths

@Rich-Harris
Copy link
Member Author

ah it worked!

<figure>
<enhanced:img
src="./summit.png"
src="./summit.png?w=800;1200;2000;2800;4400"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd forgotten too, but the docs say to use sizes instead: https://kit.svelte.dev/docs/images#sveltejs-enhanced-img-srcset-and-sizes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to just specify the width if it basically fills the screen (which it does up until the point that it wouldn't make any difference) — IIUC sizes is necessary if you know it'll be x pixels wide when the screen is y pixels wide, but it's a lot more finicky and brittle

@Rich-Harris Rich-Harris merged commit 4743563 into main Oct 13, 2024
3 checks passed
@Rich-Harris Rich-Harris deleted the giant-image branch October 13, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants