Skip to content

component/thumb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thumb

Scale an image or data uri within the given dimensions.

canvas thumbnail image generator

Installation

$ npm install thumb-component

Example

var thumb = require('thumb');
var input = document.querySelector('input');

input.onchange = function(e){
  var reader = new FileReader;

  reader.onload = function(){
    thumb(reader.result, 200, 200, function(err, img, datauri){
      document.body.appendChild(img);
    });
  };

  reader.readAsDataURL(input.files[0]);
};

License

MIT

About

Scale an image or data uri within the given dimensions

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •