image-crafter
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mage-crafter: Optimal Image Resizing for File Uploads

ImageCrafter is a lightweight TypeScript library designed to streamline the process of resizing images before uploading, making it the ideal solution for adhering to your application's specific size requirements.

Features:

  • Simple Integration: Easily incorporate ImageCrafter into your project with minimal setup.
  • File Format Ready: ImageCrafter automates the image resizing process while ensuring the output adheres to your application's required file format, enabling seamless uploads.
  • Compatibility: Works seamlessly with popular front-end frameworks such as Vue.js, Angular, and React.
  • Customizable: Fine-tune the resizing parameters to precisely match your application's size requirements.

Props:

Name Type Description
file File The input image file to be resized.
width number The desired width for the resized image.
height number The desired height for the resized image.
imageName string The name to be assigned to the resized image.

Usage:

Install ImageCrafter:

npm install imagecrafter

Include ImageCrafter in your JavaScript file:

import {resize} from 'image-crafter';

const inputElement = document.getElementById('fileInput');

inputElement.addEventListener('change', (event) => {
  const file = event.target.files[0];

  // Resize the image to match your application's specific requirements
  resize({file, width: 300, height: 200, imageName: file.name})
    .then((resizedFile) => {
      // Use the resizedFile for uploading or further processing
      console.log(resizedFile);
    })
    .catch((error) => {
      console.error('Error:', error);
    });
});

Customize as Needed:

Adjust the resize parameters according to your application's specific size requirements.

Now, you can effortlessly enhance your image upload functionality with ImageCrafter, ensuring images meet your application's size specifications for an optimized user experience!

Package Sidebar

Install

npm i image-crafter

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

8.19 kB

Total Files

5

Last publish

Collaborators

  • harshamp