[关闭]
@mansonchor 2014-04-02T03:47:10.000000Z 字数 645 阅读 668

img_process.start_img_process( img_file , [process_options] , callback )

@return {none}

@param {file} img_file: 图片文件

@param {json} process_options: 参数

{int} max_width [defalut 600]: 等比缩放最大宽

{int} max_height [defalut 6000]: 等比缩放最大高

{float} quality [defalut 0.99]: 图片压缩质量[0.00 - 1.00]

{string} type [defalut image/jpeg]: 图片类型[png,jpg,gif]

@param {function} callback : 回调函数,返回参数是图片处理后的 base64数据流

  1. <input id="img_file" type="file" accept="image/*">
  1. document.getElementById('img_file').onchange = function()
  2. {
  3. var img_file = this.files[0]
  4. img_process.start_img_process(img_file,{ max_width : 1024 , quality : 0.7 , type : img_file.type },function( base64_url )
  5. {
  6. var image = new Image()
  7. image.src = base64_url //可以直接用base64数据显示图片
  8. })
  9. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注