Next.js Image equivalent
Is there any plans of making a next.js Image component equivalent, that optimizes images in TanStack Start?
5 Replies
conscious-sapphire•2mo ago
@Ali Hello. Not sure about TS start rolling out their own <Image> but you should take a look at https://unpic.pics/
conscious-sapphire•2mo ago
Should get your job done
ambitious-aqua•2mo ago
hey, did you manage to implement image optimizaiton in TanStack Start?
solid-orangeOP•2mo ago
I tried unpic like suggested above and it worked great.
From unpic's docs:
Differences from next/image
The @unpic/react/next component is similar in concept to next/image, and can use the same image optimizer. However, it has a number of differences that may mean you prefer to use it instead.
When unpic-img detects that you are using a supported CDN it will load the images from there directly, using the CDN’s own image resizing rather than Next.js. This saves the need to process the image twice, and means that you can use the more powerful features of the image CDN.
Unlike next/image, unpic-img will not distort the image to fit the requested size as it uses object-fit: cover by default, and if using a supported CDN it will crop the image to the requested aspect ratio.
There is no need to specify a loader, because unpic-img will automatically detect the CDN and use the correct loader, and supports many more than Next.js.
unpic-img includes three built-in layout modes: fixed, constrained, and fullWidth. These affect how the image resizes, but also allows smarter generation of the srcset and sizes attributes.
conscious-sapphire•2mo ago
Great to hear you liked it :)