1.0.0 • Published 7 years ago

ng-jic v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

ng-jic

angular module for image compression based on J-I-C https://github.com/brunobar79/J-I-C

How to install it?

  • First load angular with cdn or local file.
  • Then you can:

    • NPM (outdated):

      npm intall ng-jic

    • CDN:

minified:

<script src="https://cdn.rawgit.com/leunardo/ng-jic/master/src/ng-jic.min.js" type="text/javascript"></script>

development:

<script src="https://cdn.rawgit.com/leunardo/ng-jic/master/src/ng-jic.js" type="text/javascript"></script>

How to use it?

  1. Add ng-Jic to your module: angular.module('example', ['ngJic'])

  2. Add the service into your controller: app.controller('controller', function($scope, ngJic) {...}

  3. ngJic.compress(myImage, quality, outputFormat?)

? indicates optional

The accepted output formats currently are: jpg (converted to jpeg anyway), jpeg and png due to a limitation on canvas. See this

Note that myImage must be a HTMLImageElement in order to work. This will return you another HTMLImageElement that you can use it to render the image into the DOM or another amazing things you can do with HTMLImageElement.