Ionic Image Resize before upload to Firebase

I have an issue to resize image before uploading to Firebase , i found this GitHub repo
and i would appreciate any help in how to use it with Ionic 1 app , i treid but with no luck ,
please if anyone have using this or have any other useful resource to share .


1 Like

Many thanks @thesourav , i added the plugin to my project and inject it as dependency in app.js but after i serve my app , i got error message " the module is not available , is this plugin compatible with ionic 1 ?

what dependency did you inject?

@thesourav sorry for being late to reply different times zone, well , i added image_resizer , i don’t know if this is correct or not

No dependency is needed as the code is wrapped and sent by within the
window object.
Remove that and it will work.

@thesourav do i need to reference any JavaScript file in the index page.

Amazing , it works great many thanks @thesourav , you are my hero .
here is what i have done so far if anyone need it
i have added this plugin to my image service
resizeimage :function(uri)
var options = {
uri: uri,
folderName: “Protonet Messenger”,
quality: 90,
width: 500,
height: 600};

            function(image) {

// here you will get cropped pic
}, function() {
// failed: grumpy cat likes this function
and i have passed URI from my controller
var sourcePath=“file:///” +$scope.images[$scope.selectedimgindex].id.split(’/’).slice(1).join(’/’)

1 Like

If you have installed it via Cordova CLI you don’t need that as well.

1 Like