-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add AVIF image support to beta image plugin (#28742)
* Upgrade sharp * Add avif support * Add avif e2e tests * Allow - but warn about - using just AVIF * Add missing AVIF gql type * Upgrade e2e test executor
- Loading branch information
Showing
21 changed files
with
133 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+578 KB
...s/image.js/GatsbyImage -- avif format -- renders correctly on 1027x768.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+297 KB
...ots/image.js/GatsbyImage -- avif format -- renders correctly on ipad-2.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67.9 KB
...s/image.js/GatsbyImage -- avif format -- renders correctly on iphone-6.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+578 KB
...s/image.js/StaticImage -- avif format -- renders correctly on 1027x768.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+297 KB
...ots/image.js/StaticImage -- avif format -- renders correctly on ipad-2.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67.9 KB
...s/image.js/StaticImage -- avif format -- renders correctly on iphone-6.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as React from "react" | ||
import { GatsbyImage, getImage } from "gatsby-plugin-image" | ||
import { useStaticQuery, graphql } from "gatsby" | ||
import { TestWrapper } from "../../components/test-wrapper" | ||
import Layout from "../../components/layout" | ||
|
||
const Page = () => { | ||
const data = useStaticQuery(graphql` | ||
query { | ||
file(relativePath: { eq: "cornwall.jpg" }) { | ||
childImageSharp { | ||
gatsbyImageData(maxWidth: 1024, layout: CONSTRAINED, formats: [AVIF]) | ||
} | ||
} | ||
} | ||
`) | ||
|
||
return ( | ||
<Layout> | ||
<h1>AVIF</h1> | ||
<TestWrapper> | ||
<GatsbyImage image={getImage(data.file)} alt="cornwall" /> | ||
</TestWrapper> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default Page |
22 changes: 22 additions & 0 deletions
22
e2e-tests/visual-regression/src/pages/static-images/avif.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as React from "react" | ||
import { StaticImage } from "gatsby-plugin-image" | ||
import { TestWrapper } from "../../components/test-wrapper" | ||
import Layout from "../../components/layout" | ||
|
||
const Page = () => { | ||
return ( | ||
<Layout> | ||
<h1>AVIF</h1> | ||
<TestWrapper> | ||
<StaticImage | ||
src="../../images/cornwall.jpg" | ||
alt="cornwall" | ||
formats={["avif"]} | ||
maxWidth={1024} | ||
/> | ||
</TestWrapper> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters