cordova-plugin-simple-image-resizer

0.2.0 • Public • Published
    # Image Resizer for Cordova #

By: Protonet GmbH

Authors: Joschka Schulz

Adding the Plugin

Use the Cordova CLI and type in the following command:

// This plugin uses the cordova-plugin-camera
cordova plugin add cordova-plugin-camera

// This plugin
cordova plugin add https://github.com/protonet/cordova-plugin-image-resizer.git

Sample Code

At the moment the plugin is available on android, iOS and windows

resize

window.ImageResizer.resize(options, success, failed);

Options

  • uri(String): The Uri for the image on the device to get scaled
  • folderName(String, required on Android): The name of the folder the image should be put in android only
  • fileName(String, required on iOS): A custom name for the file. Default name is a timestamp.
  • quality(Number): Quality given as Number for the quality of the new image android and iOS only
  • width(Number): The width of the new image,
  • height(Number): The height of the new image
  • base64(Boolean): Whether or not to return a base64 encoded image string instead of the path to the resized image iOS only

Android Example

var options = {
      uri: uri,
      folderName: "Protonet Messenger",
      quality: 90,
      width: 1280,
      height: 1280,
      base64: true};

window.ImageResizer.resize(options,
  function(image) {
     // success: image is the new resized image
  }, function() {
    // failed: grumpy cat likes this function
  });

Package Sidebar

Install

npm i cordova-plugin-simple-image-resizer

Weekly Downloads

12

Version

0.2.0

License

MIT

Unpacked Size

28.1 kB

Total Files

11

Last publish

Collaborators

  • thathalas