简体   繁体   English

如何使用Angular.js添加裁剪图像

[英]How to add crop image using Angular.js

I need one help.I am using Angular.js( ie-ngFileUpload ) to upload image .Here i need to crop that image according to the required height and width.I am explaining my code below. 我需要一个帮助。我正在使用Angular.js( ie-ngFileUpload )上传图像。在这里,我需要根据所需的高度和ie-ngFileUpload裁剪图像。我在下面解释我的代码。

<input type="file" class="filestyle form-control" data-size="lg" name="uploadme" id="bannerimage"  ng-model="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="20MB" ngf-min-height="100" ngf-resize="{width: 100, height: 100}"  custom-on-change="uploadFile" required="required" ngf-select="onFileSelect($file);">

The controller side code for this is given below. 控制器端代码如下。

$scope.onFileSelect = function($files) {
 console.log('file details',$files);
 fileURL=$files;
}

In normal upload i am getting the following console message of image format. 在正常上传中,我收到以下图像格式的控制台消息。

$ngfName: "ADMIN_CATETYPE_IMG_PATHorig_iceproductgrooming2.png"
name: "ADMIN_CATETYPE_IMG_PATHorig_iceproductgrooming2.png"
size: 16903
type: "image/png"

Here i need if the any image will not match the required height and width given it will ask to crop that image and after cropping again the image will set inside the file input field in proper format which is given above.Here i am using angular.js ngFileUpload module.Please help me. 在这里,我需要是否任何图像都不符合要求的高度和宽度,因为它将要求裁剪该图像,并且在再次裁剪后,该图像将以上面给出的正确格式设置在文件输入字段中。 js ngFileUpload模块。请帮助我。

您可以使用此ngCrop指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM