Skip to content

Repository files navigation

A {N} Image Cropping Plugin

LicensenpmnpmGitHub release

Notes

iOS 8+

Android 17+

Based on

TOCropViewController for iOS

uCrop for Android

Installation

Run tns plugin add nativescript-imagecropper

Android Install Notes

This plugin is designed according to {N} 2.0 Specs. For Android, you will need to modify the AndroidManifest.xml file.

Add the following to the AndroidManifest.xml

<manifest>
<application>
<activityandroid:name="com.yalantis.ucrop.UCropActivity"android:screenOrientation="portrait"/>
</application>
</manifest>

Usage

To use the image cropping module you must first require it.

varicModule=require("nativescript-imagecropper");

Methods

show(ImageSource): Returns a cropped ImageSource

varcropper=newicModule.ImageCropper();cropper.show(picture).then(function(args){console.log(JSON.stringify(args));}).catch(function(e){console.log(e);});

show(ImageSource,Options): Returns a cropped and resized ImageSource

varcropper=newicModule.ImageCropper();cropper.show(picture,{width:300,height:300}).then(function(args){console.log(JSON.stringify(args));}).catch(function(e){console.log(e);});

Options

OptionTypeDescription
widthnumberThe width of the image you would like returned.
heightnumberThe height of the image you would like returned.

Returned Result Arguments

ArgumentTypeResult(s)
responsestringSuccess
Cancelled
Error
imageImageSourcenull if there was an error or was cancelled
ImageSource on success

About

A nativescript image cropping plugin.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages