Last updated: May-23-2023
On this page:
Learn how to deliver Cloudinary images in your Next.js application using the Next.js Image component. Add Cloudinary URLs to the list of allowed domains for the Image component and use the built-in Next.js Cloudinary loader to take advantage of more Cloudinary features.
NoteThe instructions to serve images directly from Cloudinary work only for Next.js 12 and below due to Next.js 13 deprecating global loaders. Instead, try the CldImage component of the Next Cloudinary library.
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
The Next.js Image component
|0:05||There are many components and tools that Next.js provides out of the box, including the Next.js Image component, which implements its own optimization capabilities. You can use the Image component together with Cloudinary delivery URLs to take advantage of both technologies.|
Replace existing img tags with Next.js Image components
|0:21||Import the Image component from
Add the Cloudinary domain to the allowed list
|0:29||To allow images to originate from Cloudinary, add the Cloudinary domain to the allowed list. In next.config.js, add an
See example code.
Serve images directly from Cloudinary
Only for Next.js 12 and below. To allow images to be served directly from Cloudinary, use the loaders functionality. In next.config.js,replace the
See example code (this doesn't use global loaders so can be used with Next.js 13).
- Watch more Dev Hints videos on the Cloudinary YouTube channel.
- Try out the community-developed Next Cloudinary library that provides components to enable you to upload and apply popular Cloudinary transformation and optimization features to your media when building Next.js applications.
If you like this, you might also like...
Embedding Videos in Next.jsUse the Cloudinary Video Player to embed videos using Next.js
Upload Assets in ReactUpload assets using the Upload widget in a React App
Create Social Media CardsDynamically create social media image cards using Next.js
Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.