mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Summary Replaces the Cloudinary-backed image gallery example with a Vercel Blob–backed equivalent. The migration is driven by the broader move of [`vercel/nextconf-image-gallery`](https://github.com/vercel/nextconf-image-gallery) (the deployed companion to this example) off Cloudinary. - Renamed `examples/with-cloudinary` → `examples/with-vercel-blob` via `git mv` (history preserved). - Images are discovered at build time via the `@vercel/blob` SDK's `list()` API, then probed with [`sharp`](https://github.com/lovell/sharp) for dimensions and to pre-generate base64 blur placeholders. `next/image` (Vercel's image optimizer) handles resizing — no Cloudinary `c_scale,w_*` transform URLs. - `ImageProps` is now `{ id, url, width, height, blurDataUrl }` (was `{ public_id, format, ... }`). - `utils/cachedImages.ts` does the listing + dimension probe + blur placeholder generation. - Removed `utils/cloudinary.ts` and `utils/generateBlurPlaceholder.ts`. - `next.config.js` `remotePatterns` now allows `*.public.blob.vercel-storage.com`. - Deps: dropped `cloudinary`, `imagemin`, `imagemin-jpegtran`; added `@vercel/blob` and `sharp`. - `.env.local.example` reduced to a single `BLOB_READ_WRITE_TOKEN`. - README rewritten: blob description, deploy-button env, setup steps, references. ## Test plan - [x] `npx create-next-app --example with-vercel-blob ./blob-app` clones cleanly - [x] After populating a blob store and `.env.local`, `npm run dev` renders the gallery with blur placeholders - [x] `npm run build` succeeds (sharp probe + placeholder generation runs at build time) - [x] Vercel deploy button flow prompts only for `BLOB_READ_WRITE_TOKEN` --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Joseph <[email protected]>
2.2 KiB
2.2 KiB
Next.js & Vercel Blob example app
This example shows how to create an image gallery site using Next.js, Vercel Blob, and Tailwind.
Images are discovered at build time via the @vercel/blob SDK's list() API, then probed with sharp to derive dimensions and pre-generate base64 blur placeholders for next/image. The blob url is served as-is — next/image (Vercel's image optimizer) takes care of responsive avif/webp variants.
Deploy your own
Deploy the example using Vercel:
Check out our Next.js deployment documentation for more details.
How to use
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-vercel-blob with-vercel-blob-app
yarn create next-app --example with-vercel-blob with-vercel-blob-app
pnpm create next-app --example with-vercel-blob with-vercel-blob-app
Setup
- Create a Vercel Blob store and upload your images to its root.
- Copy
.env.local.exampleto.env.localand setBLOB_READ_WRITE_TOKENto the store's read/write token. (When deploying via the button above, set it as an environment variable on the project.) npm install && npm run dev.
References
- Vercel Blob: https://vercel.com/docs/storage/vercel-blob
@vercel/blobSDK: https://vercel.com/docs/storage/vercel-blob/using-blob-sdknext/image: https://nextjs.org/docs/api-reference/next/image