DEV Community

Cover image for Net Gala: Netlify Img Transforms
Nabil Alamin
Nabil Alamin

Posted on β€’ Edited on

3 1 1 1

Net Gala: Netlify Img Transforms

This is a submission for the Netlify Dynamic Site Challenge: Visual Feast.

What I Built

It's more of a snack than a feast, but I made a gallery app to recreate pieces of a couple of sites I found on awwwards. It's got nice transitions, has a monochromatic feel and takes advantage of Netlify's Image CDN and it's transforms feature.

Demo

Give it a try: Link ✨
Here's the CodeπŸ’»

Platform Primitives

I used the CDN for fetching and transforming images in my NextJS app, it also provides some amazing cache out of the box. Using the custom loader prop in the next/image component, I was able to apply the following transforms:

  • Sizing
  • Object Fit
  • Format
  • Quality

Here's a snippet of the loader:

  const loadImage = (args: ImageLoaderProps) => {
    const { src } = args;

    return `.netlify/images?url=${src}&w=${transforms.width}&h=${transforms.height}&q=${transforms.quality}&fit=${transforms.fit}&fm=${transforms.format}`;
  };
Enter fullscreen mode Exit fullscreen mode

And here's the UI implementation:
Transformation UI

Generally, when using NextJS 13.5+ with Netlify, you don't need a custom loader, the cdn works by default with next/image but I needed the loader for some of the transforms and flexibility in rendering. Thanks @hrishikeshk for pointing that out.

Conclusion

It was a fun experience building this, I got the chance to implement some nice designs and transitions, play around with CSS and try out a new component library. I'm also really delighted with how the bottom section turned out:

bottom-section

Thanks for reading and have a great day πŸ‘‹

wave-gif

...I wonder if anyone got the pun in the title πŸ€”

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (2)

Collapse
 
philiphow profile image
Philip How β€’

Great animations! The interface is really intuitive.

Collapse
 
arndom profile image
Nabil Alamin β€’

Glad you liked it 😊

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more