Next.js

Installation

Cortado.js can be easily installed via npm:


npm install cortado-js

Usage

In Next.js, Cortado.js seamlessly optimizes images for improved performance. You can use the optimizeImage function to optimize images and the resizeImage function to resize images according to your requirements. Here's how to integrate both methods into your Next.js application:


// Import optimizeImage and resizeImage functions from Cortado.js
import { optimizeImage, resizeImage } from 'cortado-js';

const MyComponent = () => {
  // Call optimizeImage with the path to your image
  const optimizedImage = optimizeImage('image.jpg');
  
  // Call resizeImage to resize the image to a specific width and height
  const resizedImage = resizeImage('image.jpg', { width: 300, height: 200 });
  
  return (
    <div>
      {/* Use the optimized image source in your component */}
      <img src={optimizedImage} alt="Optimized Image" />
      
      {/* Use the resized image source in your component */}
      <img src={resizedImage} alt="Resized Image" />
    </div>
  );
};

export default MyComponent;

Cortado.js provides both optimization and resizing capabilities, ensuring that your Next.js application delivers high-quality images with optimal performance.

© 2024 Cortado. All rights reserved.

Designed by Ditych. Powered by Framer.

© 2024 Cortado. All rights reserved.

Designed by Ditych. Powered by Framer.