1.0.0 • Published 8 years ago

jquery-image-reader v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

jQuery Image Reader

contributions welcome Join the chat at https://gitter.im/ipanardian/jquery-image-reader Release Dependencies GitHub license HitCount

A jQuery plugin that previews image very fast without needing to upload to your server.

This plugin implement FileReader API so you can asynchronously read the contents and avoid server uploads of raw user files. You can also pre-treat content before you manually upload user content to your servers.

Demo

http://indosystem.github.io/jquery-image-reader

Usage

<!-- HTML -->
<input type="file" id="upload-file" multiple /><br/>
<div id="image-preview"></div>
// JS
$('#upload-file').imageReader();

// or
$('#upload-file').imageReader({
  destination: '#image-preview'
});

// callback
$('#upload-file').imageReader({
	onload: function(img) {
		// your callback code
		console.log({
			width: img.width,
			height: img.height
		});
		$(img).css('margin-top', '20px');
	}
});

Install

bower install jquery-image-reader

Browser compatibility

The Uncompressed file implement new features from the JavaScript ECMA-262 specification (ES6) while the compressed file has transpiled using Babel.js into equivalent code.

Tested on Chrome 49, Safari 9.1, Firefox 43. Chrome and Firefox for Android.

https://developer.mozilla.org/en-US/docs/Web/API/FileReader#Browser_compatibility

License

The MIT License (MIT)