Skip to content

misabitencourt/js-image-compress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-image-compress

Compres images on browser with javascript

Example (es5):

var imageSource = 'http://www.mysite.com/my-image.jpg'; // base64 or link

// source, dimension, compression, success, error
$image.resize(imageSource, {width: 340, height: 340}, 0.4, function(file) { 
  console.log('Image base64:');
  console.log(file);
}, function() {
  console.error('Error!!');
});

Example (es2015):

let imageSource = 'http://www.mysite.com/my-image.jpg'; // base64 or link
$image.resize(imageSource, {width: 340, height: 340}, 0.4, (file) => {
  console.log(`Image base64: ${file}`);
}, () => {
  console.error('Error!!');
});

About

Compress images on browser with javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published