Skip to content

dennismarksbury/cordova-plugin-crop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-crop

Crop an image in a Cordova app

Install

$ cordova plugin add --save cordova-plugin-crop

Usage

function onSuccess (croppedImageUrl) {}
function onFail (errorMessage) {}
var options = {
  quality: 1
};

// Crops with a square ratio
plugins.crop.crop(onSuccess, onFail, '/path/to/image', options)

// Crops with a fixed ratio of 800x600
plugins.crop.crop_fixed_ratio_800x600(onSuccess, onFail, '/path/to/image', options)

// Crops with the provided orientation (height/width)
options.height = 100;
options.width = 100;
plugins.crop.crop_fixed_ratio(onSuccess, onFail, '/path/to/image', options)

or, if you are running on an environment that supports Promises (Crosswalk, Android >= KitKat, iOS >= 8)

plugins.crop.promise('/path/to/image', options)
.then(function success (newPath) {
})
.catch(function fail (err) {
})

API

  • quality: Number The resulting JPEG quality. default: 100
  • height: Number The desired height of the cropped image
  • width: Number The desired width of the cropped image

Libraries used

License

MIT © Jeduan Cornejo

About

Crop an image in Cordova

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Objective-C 90.8%
  • Java 7.6%
  • JavaScript 1.6%