首页 > 解决方案 > 在 Angular 8 中使用 ng2-img-max 调整图像大小时出错

问题描述

当我更新到 Angular 8 时,我的调整大小方法ng2-img-max停止工作,现在显示此错误。

core.js:6014 ERROR ReferenceError: n is not defined
    at getStringFromDB (exif.js:741)
    at readEXIFData (exif.js:748)
    at findEXIFinJPEG (exif.js:449)
    at handleBinaryFile (exif.js:370)
    at FileReader.fileReader.onload (exif.js:391)
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Object.onInvoke (core.js:39699)
    at ZoneDelegate.invoke (zone-evergreen.js:358)
    at Zone.runGuarded (zone-evergreen.js:134)
    at FileReader.<anonymous> (zone-evergreen.js:118)

代码是:

this.ng2ImgMax.resize([image], 1000, 200).subscribe

有谁知道如何解决这个问题?

标签: angular

解决方案


我使用 npm i ngx-image-compress 解决它并卸载 ng2-img-max 看到这个链接 https://www.npmjs.com/package/ngx-image-compress


推荐阅读