RaananW / PhoneGap-Image-Resizer

Providing an image resizer plugin for phonegap projects on both Android and iOS
93 stars 89 forks source link

saving image with url not working #2

Closed jdj1229 closed 9 years ago

jdj1229 commented 11 years ago
 window.imageResizer.storeImage(
              function(data) { 
                var smallImage = document.getElementById('smallImage');
                smallImage.style.display = 'block';
                smallImage.src = imageURI;

              }, function (error) {
                alert("Error : \r\n" + error);
                //console.log("Error : \r\n" + error);
              }, imageURI, {filename :"test",imageDataType:ImageResizer.IMAGE_DATA_TYPE_URL ,format:'jpg',directory:"/DCIM/Camera"});

this give a error NULL is there something wrong with the code?

jdj1229 commented 11 years ago

well fome reason the ImageResizer.IMAGE_DATA_TYPE_URL was still making the java get default fixed that and file:/// in imageUri should be removed. saved the data in same folder as camera but then image dont show checked with file manager and i see it needs to be renamed before you see it

RaananW commented 11 years ago

Hi, sorry, didn't understand at the end if it is a code error or not... Maybe we can avoid the error somehow? Is it a javascript error, or a Java error (as i understand, java)

jdj1229 commented 11 years ago

The error was that the ImageResizer.IMAGE_DATA_TYPE_URL was not recognized in you java file for some reason and it uses the default base64 type thus giving me an error worked through it by hardcoding url type on the java file, can you check the code on the call on the imageresizer may have put something wrong though i am not sure

RaananW commented 11 years ago

So i am keeping it open and will check when i find the time.

jdj1229 commented 11 years ago

Ok thanks, very nice plugin btw :)

jdj1229 commented 11 years ago

Lol sorry accidentally clicked the close so near to comment

steffenmllr commented 11 years ago

Also had Problems saving (Phonegap 2.2), made a few changes - works for me now. https://gist.github.com/steffenmllr/5008428

Tell me if it worked.

edit: Changed the gist URL

thejae commented 11 years ago

@steffenmllr seems like yout git is down..?

RaananW commented 11 years ago

Sorry for leaving this opened for so long, will debug this as soon as i can. And yes, the gist you provided is 404 at the moment...

RaananW commented 11 years ago

Hi, i have made a few changes to the android version (it is now 2.1+ conform). Could have been a bit better organized, but it is now working for me. Let me know if it solved the problem

ddcovery commented 9 years ago

I have the same problem. The problem is in the imageresize.js file when buiding the params of the storeImage function

Name of the option must be "imageDataType", but "imageType" is used:

imageDataType: options.imageType ? options.imageType : ImageResizer.IMAGE_DATA_TYPE_URL,

I personally use the 2 names in prevision you will correct this issue

var saveImage = function(imageData, imageDataType, dstFolder, dstName){
    var deferred = $q.defer();
    window.imageResizer.storeImage(
        deferred.resolve,
        deferred.reject,
        imageData,  
        {
           imageType:imageDataType,
           imageDataType: imageDataType,
           filename: dstName,
           directory: dstFolder,
           photoAlbum: false,
           pixelDensity: false
        }
    )
    return deferred.promise
}