我按照此脚本压缩图片:https://github.com/oukan/angular-image-compress
有人知道如何解决此错误,在上传到服务器端之前压缩图像? 这个脚本工作正常,如果我只使用php,但是使用laravel我会收到此错误!
使用未定义的常量image1 - 假设' image1'
在视图中的代码下方:
<div ng-controller="demoCtrl">
<h2>Single</h2>
<input id="inputImage" type="file" accept="image/*" ng-model="image1" image="image1" resize-max-height="800" resize-max-width="800" resize-quality="0.7" resize-type="image/jpg" ng-image-compress/>
<img ng-src="{{image1.compressed.dataURL}}" />
<h2>Multiple</h2>
<input id="inputImage" type="file" accept="image/*" ng-model="imageList" image="imageList" resize-max-height="800" resize-max-width="800" resize-quality="0.7" resize-type="image/jpg" multiple="multiple" ng-image-compress/>
<div>
<img ng-src="{{item.compressed.dataURL}}" ng-repeat="item in imageList" />
</div>
</div>