Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.2 isn't avaliable in NPM #66

Open
brcontainer opened this issue Mar 31, 2019 · 3 comments
Open

Version 0.2 isn't avaliable in NPM #66

brcontainer opened this issue Mar 31, 2019 · 3 comments

Comments

@brcontainer
Copy link

brcontainer commented Mar 31, 2019

Update NPM please.

In NPM 0.1.1 is last version, but I need 0.2 features for Android (base64), thanks!

Note: NPM is not auto sync


Alternative solution

Install using command:

npm i github:JoschkaSchulz/cordova-plugin-image-resizer#v0.2.0

Or put in your package.json

    "cordova-plugin-simple-image-resizer": "github:JoschkaSchulz/cordova-plugin-image-resizer#v0.2.0",
@wolzenbug
Copy link

Thank you @brcontainer
Do you (or anyone else in here) know a way to use the v0.2.0 branch in a ionic-native project? The ionic-native project only comes with v0.1.0, which has an iOS thumbnail dimension bug.

@brcontainer
Copy link
Author

brcontainer commented Jul 12, 2019

Thank you @brcontainer
Do you (or anyone else in here) know a way to use the v0.2.0 branch in a ionic-native project? The ionic-native project only comes with v0.1.0, which has an iOS thumbnail dimension bug.

Is not possible... You maybe can recreate this methods in a provider, but it's "complicated" ... use in "pure" JS in your method:

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

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

An example with Promise (example in typescript projects):

methodFooBar()
{
    return new Promise((resolve, reject) => {
        let options = {
            uri: uri,
            folderName: "Protonet Messenger",
            quality: 90,
            width: 1280,
            height: 1280,
            base64: true,
            fit: false
        };

        (<any>window).ImageResizer.resize(options, (image) => {
            resolve(image);
        }, () => {
            reject();
        });
    });
}

Note: (<any>window) is needed for "compile"

@wolzenbug
Copy link

Thank you for your efforts!
Your second example works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants