Skip to content

feat: don't upscale images #441

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

Merged
merged 4 commits into from
Jun 28, 2021
Merged

feat: don't upscale images #441

merged 4 commits into from
Jun 28, 2021

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jun 25, 2021

This PR prevents us from resizing images to larger than the source. Instead we can let next/image do the resizing in the browser. Rather than returning the max size image, we instead redirect to the image that is the correct size. This is to avoid having multiple URLs that all refer to the same image, which the browser will potentially download multiple times.

Demo page. The image is displayed at twice the source size. Open the image in a new tab and you'll see it has redirected to the smaller size

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jun 25, 2021
Copy link

@lindsaylevine lindsaylevine left a comment

Choose a reason for hiding this comment

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

whoa

@lindsaylevine
Copy link

npm ERR! @netlify/routing-local-proxy-darwin-x64 not accessible from netlify-cli:@netlify/routing-local-proxy

pain

@ascorbic ascorbic merged commit e622e1a into main Jun 28, 2021
@ascorbic ascorbic deleted the image-size branch June 28, 2021 09:42
serhalp pushed a commit that referenced this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants