uploadfilereducedsize
v0.9.4
Published
this is a reactJs component Which acts like an HTML input file that can reduce images to a desiered size before sending it to the server
Downloads
4
Maintainers
Readme
Getting started with reducing the size file upload component
Description
This is a React upload component that also reduces the image file size if necessary. the parameters of the element are:
- onSelectFile - select file handler
- maxWidth: maximum width of the reduced file image. It is measured in pixels. if the uploaded image width is smaller than the maximum file width then there won't be any file reduction.
- max-height: Optional. do the same thing but for height.
Install the Component
In order to install this component simply execute the following command:
npm i uploadfilereducedsize
Here is how you implement the component in your react code
import './App.css';
import InputForm from 'uploadfilereducedsize/InputFile';
function App() {
const selectSymbolHandler = (selectedSymbol, fileName) => {
console.log('select...');
}
return (
<div className="App">
<div className="videoContainer">
<InputForm onSelectFile={(selectedSymbol, fileName) => selectSymbolHandler(selectedSymbol, fileName)} maxWidth={600}></InputForm>
</div>
</div>
);
}
export default App;
This component was made by Kobi Krasnoff