Package Exports
- image-crafter
- image-crafter/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (image-crafter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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!