0.2.0 • Published 7 years ago

simple-upload-preview v0.2.0

Weekly downloads
9
License
ISC
Repository
github
Last release
7 years ago

Simple upload preview

A small package to preview image before the real upload.

Usage

Javascript Vanilla (pure javascript)

var upload = require('simple-upload-preview');

const file = document.querySelector('input[type="file"]'); // <input type="file" />
var image = document.querySelector('#blah'); // <img src="#" id="blah" />

file.addEventListener('change', upload.preview({
    element: image
    }, function(err, image) {
	// image variable is the image element with the file from input sorced.
}));

Jquery

Download this repository or use npm / yarn to download it.

<script src="node_modules/simple-upload-preview/browser/simple-upload.js"></script>
var image = $('#blah') // <img id="blah" />
$('input[type="file"]').preview({element: image}, function(error, image) {
    // Do whatever you want with the `image` element
});

Installing

npm install simple-upload-preview

yarn install simple-upload-preview

Or download it from this repository

License

MIT © Rafael Acioly

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago