ie中可以进行图片压缩的库

 onBeforeRead (file) {
     return new Promise((resolve, reject) => {
       new Compressorjs(file, {
         //压缩质量, 0-1
        //  quality: 0.6,
        //  //转换的类型,默认为 image/png
        // //  convertTypes: ['image/jpeg','image/png'],
        //  convertTypes: 'image/png',
        //  //需要压缩的起始大小,默认10M, 5 * 1000 * 1000
        //  convertSize: 5000000,
         //压缩成功后处理
         
          strict: true,
          checkOrientation: true,
          retainExif: false,
          maxWidth: undefined,
          maxHeight: undefined,
          minWidth: 0,
          minHeight: 0,
          width: undefined,
          height: undefined,
          resize: 'none',
          quality: 0.6,
          mimeType: '',
          convertTypes: ['image/jpeg','image/png'],
          convertSize: 1000000,
         success(result) {
           resolve(result);
         },
         error(err) {
           console.log(err.message);
           reject()
         },
       });
     });
   }

  

posted @ 2024-04-01 09:55  小白字太白  阅读(27)  评论(0编辑  收藏  举报