Coder Social home page Coder Social logo

ngcroppie's Introduction

ngCroppie - Angular Croppie Tool

Build Status Bower version NPM version Dependency Status NPM Montly Downloads MIT License

Angular Croppie Tool is an image cropping and rotating module for AngularJS based on Croppie.js
Pure Javascript implementation; Also responsive!

Dependencies

Installation

# Using bower:
$ bower install ngCroppie

# Using npm:
$ npm install ng-croppie

Basic usage

  • Include ngCroppie module into your project;
  • No dependencies are required in the controller;
  • Add <ng-croppie> tag with the following arguments:
    • src Image or Blob: path to Image File or Base64;
    • ng-model Base64: the image output;

Example

JS

function ExampleCtrl() {
  var vm = this;

  vm.inputImage = null;
  vm.outputImage = null;

  vm.onUpdate = function(data) {
    //console.log(data);
  };
}

angular
  .module('exampleModule', ['ngCroppie'])
  .controller('ExampleCtrl', [ExampleCtrl]);

HTML

<ng-croppie   src="inputImage"
              ng-model='outputImage'
              update='onUpdate'
              boundry="{w: 400, h: 400}"
              viewport="{w: 300, h: 300}"
              orientation="true"
              rotation="90"
              type="circle">
</ng-croppie>



<!-- Preview -->
<img ng-src="{{outputImage}}" />

Parameters

  • Image or Blob data: path to image file or base64;
  • Base64 ng-model: the image output, returns are a base64;
  • Function update: place a functon in the controller to run whenever changes are made to the image;
  • Object boundry { w: __, h: __ }: (optional) the size of the container that will host the croppie tool - defaults to 400x400;
  • Object viewport { w: __, h: __ }: (optional) the output size, must be smaller than the boundry or it will equal it - defaults to 300x300;
  • Boolean zoom: (optional) enable zoom slider - defaults to true;
  • Boolean mousezoom: enable mouse scroll bar to zoom in/out. Works with zoom - defaults to true;
  • Boolean zoomslider: enable zoom slider only (scrolling and pinching zoom still possible if set to false), works with zoom - defaults to true;
  • Boolean exif: (optional) enable exif orientation compatability - defaults to undefined;
  • Boolean orientation: (optional) enable custom orientation support when binding images - defaults to false.
  • Integer rotation: rotate the image by a specified degree amount, works with orientation - valid values: 90, 180, 270, -90, -180, -270;
  • String type: (optional) can either be 'circle' or 'square' - defaults to 'square';
  • Boolean mobile: (optional) enable mobile view - defaults to viewport: 250x250 and boundry: 300x300;

Version

1.2.2

Updates

  • fix source interval time for firefox
  • fix travis build badge
  • add changelog file

Contributors

  • orif-jr
  • stasinua
  • htao00
  • alanheppenstall

License

MIT © ngCroppie

ngcroppie's People

Contributors

orifn avatar allenjynroyston avatar dimasjt avatar alanheppenstall avatar htao00 avatar stasinua avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.