1.0.5 • Published 8 months ago
image-optimizer-component v1.0.5
OptimizedImage Component Documentation
The image-optimizer-component
package is used to display optimized images in your Next.js application. It provides support for both local and remote images.
Installation
To install the image-optimizer-component
package, run the following command:
npm install image-optimizer-component@latest
Usage
Import the OptimizedImage
component into your file as follows:
import OptimizedImage from 'image-optimizer-component'
export default function MyComponent() {
return (
<div>
<h1>Welcome to My Component</h1>
{/* Local image */}
<OptimizedImage src="/path/to/image.jpg" alt="Image description" />
{/* Remote image */}
<OptimizedImage src="https://ejemplo.com/imagen.jpg" alt="Image description" />
</div>
)
}
Important
You must add the path of the host from which the remote images are obtained in the NextJs configuration file.
Props
The OptimizedImage
component accepts the following props:
src
(required): The source of the image. It can be a local path or a remote URL.alt
(optional): The alternative text for the image.
License
This project is licensed under the MIT License.