转载鑫空间、鑫生活的博客:作者:张鑫旭 HTML5 file API加canvas实现图片前端JS压缩并上传 http://www.zhangxinxu.com/wordpress/2017/07/html5-canvas-image-compress-upload/