GithubHelp home page GithubHelp logo

j5int / cordova-plugin-thumbnail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from almas/cordova-plugin-thumbnail

0.0 9.0 0.0 40 KB

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

License: Apache License 2.0

Java 33.27% Objective-C 25.29% JavaScript 41.44%

cordova-plugin-thumbnail's Introduction

cordova-plugin-thumbnail

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

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)
    • outputFormat The format that the thumbnail will be generated in, valid options being PNG and JPG. (default format: JPG)
  • 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" />

cordova-plugin-thumbnail's People

Contributors

almas avatar dee42 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.