npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-smooth-crop

v1.0.1

Published

A sample Apache Cordova application that responds to the deviceready event.

Downloads

8

Readme

Crop Smooth Plugin


Crop Smooth Plugin is a Cordova plugin that is used to crop and resize images in Cordova applications. This plugin provides functions to open the image crop screen with configured options and get image dimensions from the given image array.

Platform Support


  • Android

Installation


You can install this plugin through Cordova CLI by running the following command:

cordova plugin add cordova-smooth-crop

Usage


This plugin provides two functions, "open" and "getImageDimension". Here is an example of how to use them:

Function "open"


cordova.smooth.crop.open({
    url: 'file:///path/to/image.jpg',// (string): path gambar yang akan dipotong. Contoh: file:///path/to/image.jpg
    ratio: '1/1', // (string): rasio aspek gambar yang akan dipotong. Contoh: '1/1'
    setFixAspectRatio: true, // setFixAspectRatio (boolean): mengaktifkan atau menonaktifkan rasio aspek gambar yang tetap saat memotong gambar. Contoh: false, jika nilai true ratio akan menjadi '1/1'
    size: '300x300' // (string): ukuran gambar yang akan dipotong. Contoh: '300x300'
    outputCompressQuality: 90, // (number): kualitas kompresi gambar yang dihasilkan. Contoh: 90
    cropShape: 0, // (number): bentuk potongan gambar. Contoh: 0 (RECTANGLE) [RECTANGLE,OVAL]
    guideline: 0, // (number): tampilan panduan saat memotong gambar. Contoh: 1 (ON_TOUCH) [OFF,ON_TOUCH,ON]
    scaleType: 0, // (number): tipe skala gambar saat memotong. Contoh: 0 (FIT_CENTER) [FIT_CENTER,CENTER,CENTER_CROP,CENTER_INSIDE]
    showCropOverlay: true, // (boolean): menampilkan atau menyembunyikan overlay saat memotong gambar. Contoh: true
    multiTouchEnabled: true, // (boolean): mengaktifkan atau menonaktifkan multitouch saat memotong gambar. Contoh: false
    autoZoomEnabled: false, // (boolean): mengaktifkan atau menonaktifkan auto zoom saat memotong gambar. Contoh: false
    allowRotation: true, // (boolean): mengaktifkan atau menonaktifkan rotasi gambar saat memotong gambar. Contoh: false
    allowFlipping: true, // (boolean): mengaktifkan atau menonaktifkan flipping gambar saat memotong gambar. Contoh: false
    title: "Image Cropper", // (string): judul layar potong gambar. Contoh: 'Image Cropper'
}, function success(result) {
    console.log(result); // {width:'',height:'',imgPath:'',base64:''}
}, function error(err) {
    console.error(err); // {code:'',message:''}
});

The "open" function is used to open the image crop screen with configured options. Available options are:

  • url (string): the path of the image to be cropped.
  • ratio (string): the aspect ratio of the image to be cropped.
  • setFixAspectRatio (boolean): enable or disable the fixed aspect ratio of the image when cropping the image.
  • size (string): the size of the image to be cropped.
  • outputCompressQuality (number): the compression quality of the resulting image.
  • cropShape (number): the shape of the cropped image.
  • guideline (number): the guideline display when cropping the image.
  • scaleType (number): the scale type of the image when cropping.
  • showCropOverlay (boolean): show or hide the overlay when cropping the image.
  • multiTouchEnabled (boolean): enable or disable multitouch when cropping the image.
  • autoZoomEnabled (boolean): enable or disable auto zoom when cropping the image.
  • allowRotation (boolean): enable or disable image rotation when cropping the image.
  • allowFlipping (boolean): enable or disable image flipping when cropping the image.
  • title (string): the title of the image crop screen.

Function "getImageDimension"


cordova.smooth.crop.getImageDimension(['file:///path/to/image1.jpg', 'file:///path/to/image2.jpg'], function success(result) {
    console.log(result); // {width:'',height:'',imgPath:'',base64:''}
}, function error(err) {
    console.error(err); // {code:'',message:''}
});

The "getImageDimension" function is used to get image dimensions from the given image array. You must provide an array of image paths as the first argument.

Conclusion

Crop Smooth Plugin can help simplify the use of image cropping functions in Cordova applications running on the Android platform.