Commit graph

11 commits

Author SHA1 Message Date
Tim Neutkens
989741f287
Fix image-optimizer test for Turbopack (#60978)
## What?

Follow-up to #60972 that ensures the rest of the tests pass too.

We used an RGB image (not sure how) where it should be `RGBA` as `.ico`
does not support `RGB` and https://crates.io/crates/image fails for that
case.

Details in the Rust image crate:
4989d5f83a/src/codecs/ico/decoder.rs (L59C27-L59C37)
Wayback machine of the linked post:
https://web.archive.org/web/20170911130832/https://blogs.msdn.microsoft.com/oldnewthing/20101022-00/?p=12473/

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-2182
2024-01-22 16:23:01 +01:00
Steven
0b563e86de
fix: image optimization content-type (#46219)
Upstream images can have any arbitrary `content-type` header so this PR
normalizes the value before checking it.
2023-02-21 18:00:14 -08:00
Balázs Orbán
d008f655bc
fix: skip resizing image if it's animated (#39325)
We were resizing animated images when importing them, but we don't optimize images when they come from an upstream provider. For consistency, we can skip resizing for local animated images as well.

Fixes #39317

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-05 21:28:17 +00:00
Steven
0355e5f63f
Fix next/image when src is webp but browser doesnt support it (#35190)
* Fix `next/image` when src is webp but browser doesnt support it

* Exclude old sharp since it doesnt support AVIF
2022-03-10 15:02:13 +01:00
Steven
b25f7f84b1
Fix animated png bypass from Image Optimization API (#35120)
- Fixes #34807
- Related commit 69dad3cdf9

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-07 20:29:11 +00:00
JJ Kasper
ce9c6b79f1
Fix flakey image-optimizer test (#33957)
x-ref: https://github.com/vercel/next.js/runs/5057168022?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/5055917244?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/5043791152?check_suite_focus=true
2022-02-03 20:46:06 +00:00
Steven
44b4dbcd41
Adjust AVIF size so that its smaller than WebP size (#31494)
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes #31254 
- Related to https://github.com/lovell/sharp/issues/2850
2021-11-17 20:31:16 +00:00
ihmpavel
2027d1fe7d
Fix invalid character in next/image header "Content-Disposition" (#30287)
* Image content disposition

* Add tests

* Fixed import

* Add TS types

* Revert readme.md

* Alphabet sorting

* Compile `content-disposition`

* Rename for tests

* Fix test

* Fix accidentally added letter

Co-authored-by: Steven <steven@ceriously.com>
2021-11-01 19:23:24 -04:00
Steven
b05cdb1f64
Add naturalWidth/naturalHeight to onLoadingComplete() callback (#27695)
Resolves #27213
2021-08-02 23:14:38 +00:00
stefanprobst
63aeddbbe0
URI-encode url parameter in image optimizer (#27671)
fixes #27210
maybe related: #19668

currently, the image optimizer returns 400 when an image url contains non-ascii characters. this pr uri-encodes the `url` query parameter to fix it. also see https://github.com/vercel/next.js/issues/27210#issuecomment-890305204

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-02 17:03:45 +00:00
Alex Castle
1b733423d6
Use Sharp if available for Image Optimization (#27346)
* Use sharp for image transformations when available

* Refactor resizeImage and add sharp warning

* only show sharp warning once per instance

* Modify sharp error message

* Add documentation for optional sharp dependency

* Update docs/basic-features/image-optimization.md

Co-authored-by: Steven <steven@ceriously.com>

* Import types for sharp

* Update lockfile

* Add testing against sharp

* use fs-extra for node 12

* Rename test sharp path variable

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* update squoosh specific test

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* update tests

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-22 18:11:17 -05:00