From 3bebbf00e6f4d33bfacbf38eef73a9ad7f0d9d58 Mon Sep 17 00:00:00 2001 From: Tomas Bankauskas Date: Tue, 9 Apr 2024 12:40:31 +0300 Subject: Added Image CDN page (#4) * added image-cdn * updated image-cdn page, colors, etc * added Markdown.astro and updated styles --- src/pages/_assets/corgi.jpg | Bin 0 -> 587671 bytes src/pages/image-cdn.astro | 105 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 src/pages/_assets/corgi.jpg create mode 100644 src/pages/image-cdn.astro (limited to 'src/pages') diff --git a/src/pages/_assets/corgi.jpg b/src/pages/_assets/corgi.jpg new file mode 100644 index 0000000..402232f Binary files /dev/null and b/src/pages/_assets/corgi.jpg differ diff --git a/src/pages/image-cdn.astro b/src/pages/image-cdn.astro new file mode 100644 index 0000000..aa1b4e6 --- /dev/null +++ b/src/pages/image-cdn.astro @@ -0,0 +1,105 @@ +--- +import { Image } from 'astro:assets'; +import Layout from '../layouts/Layout.astro'; +import Markdown from '../components/Markdown.astro'; +import corgi from './_assets/corgi.jpg'; + +const sampleImageSrc = '/images/corgi.jpg'; + +const astroImageSnippet = ` +When running on Netlify, \`next/image\` is automatically set-up to use Netlify Image CDN for optimized images. + +~~~jsx +import Image from 'next/image'; + +// In your component +Corgi +~~~ +`; + +const originalVsCdnSnippet = ` +In the code below, a regular \`\` tag is used in both cases for a framework-agnostic example. +Other than using \`next/image\` or rolling your own \`\` tags, you can also use the excellent [unpic-img](https://unpic.pics/). + +~~~jsx +// <== On the left, the original image +Corgi + +// ==> On the right, explicitly using Netlify Image CDN endpoint for a responsive image +Corgi +~~~ +`; +--- + + +
+
+

Image CDN

+
+
+

Using built-in Astro <Image /> component

+ +
+ Corgi +
+ Credit: photo by Alvan Nee on + + Unsplash + +
+
+
+
+

Original vs. optimized image: can you tell the difference?

+ +
+
+
+
+ + Corgi +
+
+
+
+
+
+ + Corgi +
+
+
+
+
+
+
+
+ + -- cgit v1.2.3