Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

What's the Best Way to Do Images in Next.js?

11 replies
Last updated: May 6, 2021

what is the “best” way right now to do images in Next.js that supports hotspots, cropping etc? Particularly interested in a list page with images that are all the same size/proportion and deliver all the right browser layout hints. Any examples?

May 6, 2021, 3:29 PM
May 6, 2021, 3:29 PM

I also don’t quite understand how to handle responsive images, where they are different sizes etc for different devices

May 6, 2021, 3:47 PM

user M
I actually roll my own photo component to handle images and account for hotspots/cropping/etc. from Sanity

May 6, 2021, 5:50 PM
May 6, 2021, 5:50 PM

curious why this general topic seems not well established.. did you also jsut not find anything that checked all the boxes of “give me an image that fits correctly in this hole and respects the crop I set”?

May 6, 2021, 5:51 PM

Yea exactly, nothing really checked all the boxes, and I wanted full control over the image experience

May 6, 2021, 5:54 PM

is powered by this? Looks really nice, I might have to borrow this 😬

May 6, 2021, 5:55 PM

It is! 😊

May 6, 2021, 5:57 PM

damn, I’m going to be spending lots of time in this repo. Wish I wasn’t migrating an existing site

May 6, 2021, 5:57 PM

Good luck!

May 6, 2021, 5:57 PM

huh interesting. I suppose it’s mostly agnostic to the framework in use. I’ll see how this goes. I actually use very few image types/styles so I don’t need a hugely comprehensive solution

May 6, 2021, 6:38 PM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.