Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I need one help.I am using Angular.js(i.e-ngFileUpload) to upload image .Here i need to crop that image according to the required height and width.I am explaining my code below.

<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.

share|improve this question
    
If you read the README docs of ngFileUpload, in the features list it mentions cropping and has a sample jsfiddle for integrating it with ngImgCrop to crop images: jsfiddle.net/xxo3sk41/1 – danial 2 days ago

1 Answer 1

You can use the this ngCrop directive.

share|improve this answer
    
Let me to implement this and then i will confirm you. – satya 2 days ago
    
Hey, did it work? – Tarun Dugar 2 days ago
    
Its working fine but some issue.I need some validation of this image field. – satya yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.