Comments (2)
Controller:
controllers.controller('userAvatar', [
"$scope",
function($scope){
$scope.avatar='';
$scope.croppedAvatar='';
$scope. handleFileSelect=function(evt) {
var file=evt.currentTarget.files[0];
var reader = new FileReader();
reader.onload = function (evt) {
$scope.$apply(function($scope){
$scope.avatar=evt.target.result;
});
};
reader.readAsDataURL(file);
};
}
]);
View:
<div ng-controller="userAvatar">
<div>Select an image file:
<input type="file" onchange="angular.element(this).scope().handleFileSelect(event)" />
</div>
<div class="cropArea">
<img-crop image="avatar" result-image="croppedAvatar"></img-crop>
</div>
<div>Cropped Image:</div>
<div><img ng-src="{{croppedAvatar}}" /></div>
</div>
<div ng-controller="userAvatar">
<div>Select an image file:
<input type="file" onchange="angular.element(this).scope().handleFileSelect(event)" />
</div>
<div class="cropArea">
<img-crop image="avatar" result-image="croppedAvatar"></img-crop>
</div>
<div>Cropped Image:</div>
<div><img ng-src="{{croppedAvatar}}" /></div>
</div>
from ngimgcrop.
@signumcode Give it a try:
http://jsfiddle.net/alexk111/o464px94/1/
from ngimgcrop.
Related Issues (20)
- NewBie - Does this support angular js 2 HOT 4
- can I save the circle cropped image as circle ( other parts are transparent ) instead of rectangle? HOT 5
- exception occured
- ngImgCrop in ionic iOS throwing [Generic] Creating an image format with an unknown type is an error HOT 1
- ngImgCrop doesn't work properly when using ngShow in my Angular App HOT 2
- Installation
- Base64 input image HOT 1
- How to pass crop image in form? HOT 3
- AngularJS expressions not working in <img-crop>
- Ask for help on image size HOT 1
- How to set the size of the canvas
- Is this repo abandoned? HOT 4
- show img-crop with url instead selecting file
- ngImgCrop doesn't work properly with ng-flow
- Prevent resizing if image size is less then result image size
- Mobile Safari canvas wrong proportions
- ngImgCrop is not work with form element.
- How can I use it in jquery steps? when I put the codes in one of section of steps it dosn't work.
- RangeError: Offset is outside the bounds of the DataView HOT 1
- 图片太大情况下,图片加载不出来
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngimgcrop.