Git Product home page Git Product logo

sotos.crop-image's Introduction

#sotos.image-crop module for angular

directive in angular

crop images, put watermark and save directive in angular

###v0.0.1 - v0.0.6

fix firefox

fix rotate

fix modal with Option Parameter inModal

fix save (add function )

fix touch

Limiting crop object inside area. by zaidchauhan

fix image crossOrigin

src folder

Fixes logic for default options. by Nick Darvey

###v0.0.7 Fixes Issues #16 lock rotation 45ΒΊ step

###v0.0.8 Fixes Issues #3 Responsive canvases

Fixes Issues #13 404 in console watermark

Fixes Issues #17 Remove Double clicking the editable

Demos http://sotos.gr/demos/crop-image/

###Bower Install

bower install sotos.crop-image

###Use

 <html>
  <body>
    <image-crop image-out="imageOut"  crop-options="options" ng-transclude crop-image-save="saveCrop">
       <edit-crop></edit-crop>
       <view-crop></view-crop>
    </image-crop>
  </body>
  </html>

###set the module var app = angular.module('app',['sotos.crop-image']);

in controller required

 //the image to output
 $scope.imageOut='';
 // required
 $scope.options={}; 
 // image for crop required
 $scope.options.image="image.jpg";       

##Crop Options

         app.controller('cropFullCtrl',['$scope',function($scope){
            //the image to output
            $scope.imageOut='';
 
            //make the options settings
 
            $scope.options={};                      // required
            $scope.options.image="image.jpg";       // image for crop required
            $scope.options.viewSizeWidth= 500;      // canvas size default 480 or 30% 50% 80%...
            $scope.options.viewSizeHeight= 500;
 
            $scope.options.viewShowRotateBtn= true;   //if rotate tool show default true
            $scope.options.rotateRadiansLock= true;  // lock radians default true

            $scope.options.outputImageWidth= 0 ; //output size of image 0 take the size of source image
            $scope.options.outputImageHeight= 0;
            $scope.options.outputImageRatioFixed= true; //keep the ratio of source image
            $scope.options.outputImageType= "jpeg"; //output image type
            //if this check the image crop by the original size off image and no resize
            $scope.options.outputImageSelfSizeCrop= true;
 
            //show the crop tool use only for crop and crop again one image
            $scope.options.viewShowCropTool= true;
 
            //this is the watermark if is set the watermark tool
            //show after crop
            //watermark type = text or image
            $scope.options.watermarkType='image';
            //set the image
            $scope.options.watermarkImage= null;
            //set text if type is text
            $scope.options.watermarkText= null;
            //settings for the text canvas textfill
            $scope.options.watermarkTextFillColor= 'rgba(0,0, 0, 0.8)'; //color of the letters
            $scope.options.watermarkTextFont= 'Arial'; //font

##functions

            // $broadcast functions
 
            // cropImage : crop the image and data fill the imageOut with the image.
            // reload the view with the crop image if watermark is set then watermark tool shows.
 
             $scope.cropImage= function(){
                $scope.$broadcast('cropImage');
             };
 
            // cropImageSave : send the image to the window.open() to save the image
            $scope.saveImage= function(){
                  $scope.$broadcast('cropImageSave');
            };
 
            // cropImageShow : after crop output the image with the watermark to the imageOut
 
            $scope.cropImageShow= function(){
                $scope.$broadcast('cropImageShow');
            };
         }]);

thanks for this tutorial http://www.script-tutorials.com/html5-image-crop-tool/

sotos.crop-image

sotos.crop-image's People

Contributors

sotospez avatar tiddolangerak avatar zaidchauhan avatar

Watchers

 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.