@spoonconsulting/cordova-plugin-thumbnail

1.0.3 • Public • Published

cordova-plugin-thumbnail

This plug-in implements the ability to generate image thumbnails for Cordova project. Support Android and iOS.

Installation

cordova plugin add https://github.com/almas/cordova-plugin-thumbnail.git

How to use

Thumbnails.thumbnail(srcPath, [options,] successCallbackFn, ​​failCallbackFn)

Explanation:

  • srcPath: Image path. Supported path format: file:///path/to/spot.
  • options other configuration parameter objects
    • maxPixelSize: Maximum width or height of thumbnail in pixels (default value: 120)
    • targetPath Thumbnail path. If not specified, will randomly create a file to store the generated thumbnail.
    • compression The quality of the resulting image, expressed as a value from 0 to 100. The value 0 represents the maximum compression (or lowest quality) while the value 100 represents the least compression (or best quality). (default value: 90)
  • successCallbackFn Thumbnail generates a successful callback function
  • failCallbackFn Thumbnail Generation Failed Callback Function

Example:

var options = {
        maxPixelSize: 100,
        targetPath: 'file:///path/to/file'
    };

Thumbnails.thumbnail('file:///path/source/file', options, function success(path) {
    console.log ("thumbnails generated at path:" + path);
}, function fail(error) {
    console.error(error);
});

Android specific configuration:

You need to add the following configuration in the config.xml file:

<preference name="AndroidPersistentFileLocation" value="Internal" />

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    104
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    104
  • 1.0.2
    0
  • 1.0.1
    0

Package Sidebar

Install

npm i @spoonconsulting/cordova-plugin-thumbnail

Weekly Downloads

104

Version

1.0.3

License

Apache 2.0

Unpacked Size

37.1 kB

Total Files

12

Last publish

Collaborators

  • sharinpix-admin
  • zafirskthelifehacker
  • ombr
  • dinitri-ragoo-spoon
  • azharbeebeejaun