Polymer 1.0 element for resizing images
<sc-resize> is an element that helps you resizing images, helpful before uploading
- Based on blueimp's
loadimageandcanvas-to-blob - Resize images
- Remove exif-tags (up = up)
- Etc.
First you need bower, see their site for details
bower install --save sc-resize
| Attribute Name | Functionality | Default |
|---|---|---|
| maxWidth | A number stating the maximum width of the outputed image | 1050 |
| maxHeight | A number stating the maximum height of the outputed image | 874 |
| minWidth | A number stating the minimum width of the outputed image | 140 |
| maxHeight | A number stating the minimum height of the outputed image | 80 |
| file | The file object to be resized | |
| resized | The resized blob version of the file after resizing |
<sc-resize id="resize" on-resize="resized" on-error="error"></sc-resize> resize: function (file) {
this.$.resize.set('file', file);
},
resized: function (e) {
window.alert('Successfully resized!');
window.console.log(e.detail);
},
error: function (e) {
window.alert('Sorry, this image can not be processed!');
}Contributions welcome, please create issues!