Next.js > Managing images

    Managing images

    One of the major advantages of using DatoCMS instead of any other content management systems is its responsiveImage query, which will return pre-computed image attributes that will help you setting up responsive images in your frontend without any additional manipulation.

    To make it even easier to offer responsive, progressive images on your projects, we released a package called react-datocms that exposes an <Image /> component and pairs perfectly with the responsiveImage query.

    Our solution offers the same advantages of using Next Image component, with the added benefit of having beautiful low-quality image placeholders (LQIP) in base64 format embedded directly within the page, without any additional request to be made by the browser or server:

    To take advantage of it, install the react-datocms package:

    yarn add react-datocms

    Then, inside your page, feed content coming from a responsiveImage query directly into the <Image /> component:

    import { request } from "../lib/datocms";
    import { Image } from "react-datocms";
    const HOMEPAGE_QUERY = `query HomePage($limit: IntType) {
    allBlogPosts(first: $limit) {
    coverImage {
    responsiveImage(imgixParams: { fit: crop, w: 300, h: 300, auto: format }) {
    export async function getStaticProps() {
    const data = await request({
    query: HOMEPAGE_QUERY,
    variables: { limit: 10 }
    return {
    props: {
    export default function Home({ data }) {
    return (
    { => (
    <article key={}>
    <Image data={blogPost.coverImage.responsiveImage} />
    We use cookies to enhance the user experience. Do you consent their use in accordance with our cookie policy?