Giter Club home page Giter Club logo

imagecompress's Introduction

imageCompress

用file和canvas api实现的图片压缩的jquery插件。 只有压缩质量和一些过程处理函数,使用简单,欢迎完善补充。

$('#image').imageCompress({
	'quality': 50,
	'onloadStart': function(result){
		console.log('读取图片开始'+result);
	},
	'onloadEnd': function(result){
		console.log('读取图片结束'+result);
	},
	'oncompressStart': function(result){
		console.log('压缩图片开始'+result);
	},
	'oncompressEnd': function(result){
		console.log('压缩图片结束'+result);
		$('#preview').append(result);
		$('#preview').find('img').addClass('preview');
	},
	'callback': function(){
		console.log('处理完毕');
	}
});

使用说明:

  • el:为上传框
  • quality:压缩图片质量,单位为%
  • onloadStart:读取图片开始,传入文件对象
  • onloadEnd:读取图片结束,传入图片对象
  • oncompressStart:压缩图片开始,传入压缩前图片对象
  • oncompressEnd:压缩图片结束,传入压缩后图片对象
  • callback:所有图片压缩处理完成以后的回调

imagecompress's People

Contributors

beckjiang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.