Git Product home page Git Product logo

phonegap-base64's People

Contributors

kartagis avatar mohamed-salah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phonegap-base64's Issues

Plugin not working in ios

I try to capture audio(file formate .wav) and convert into base64 but this plugin not working in ios.

unable to install the plugin

i found this error while installing this plugin.

Failed to install 'com-badrit-base64': Error: Unhandled "error" event. (The plat
form ".idea" does not appear to be a valid cordova platform. It is missing API.j
s. .idea not supported.)

Plugin not working in ios

Hi team,

I'm currently using ionic 3 and i implemented this plugin. it's working perfect on android but when i test it on ios there is an issue.

When i try to encode the image in base64 it just quit my page and nothing happens.

Please help me!!!

Paths that contain spaces cause conversion problems.

No indicative errors are printed but the base64 return value is always an empty string.

The conversion works flawlessly with paths like file:///path/to/file.ext but not with file:///path/to/file with spaces.ext

configure encoding type?

there doesn't appear to be any documentation as how this can be done. When sending an image the default is data:image/*;base64 and the * is causing problems and is really slow. Is there a way to set the default image type upon converting to base64?

for Cordova 8.0,0, it does not install

The issue is the plugin is trying to write the AndroidManifest.xml at platform/android/AndroidManifest.xml, when the AndroidManifest in newer versions is located at platforms/android/app/src/main/AndroidManifest.xml

Tested it on android 4.0.3 - Didn't work

I have passed the Base64.encodeFile function the file path returned from the phonega-camera plugin (FILE_URI) at first and it didn't work, Then I saw that the parameter I passed started with "file:///mnt/sd...", so I removed the "file://" from the string so it would be like the example written in the README file, but that didn't work either.
the callback function was called, and the base64 parameter was null.

Doron

File size triples on iOS

When converting local images to base64 on iOS, the file size becomes triple the original. The image looks the same though.

I'm using Ionic's native camera plugin with CameraOption.destinationType set to DestinationType.FILE_URI. Then I convert the image with

this.base64.encodeFile(imagePath).then(base64Image => {
   return base64Image;
});

On Android it works as expected and the file size is the same as if I would get the base64 directly from the camera with DestinationType.DATA_URL. On iOS, my 5.5 MB image becomes 16.2 MB.

Content-type boundary None when upload to API

I encountered an error when upload to my API. I test with postman and httpie it's working, but when use base64 plugin I got error "Invalid boundary in multipart: None". I already set "Content-Type: multipart/form-data" in ionic post header to my API but still got error.

http --verbose --form POST myapi.com/resources/ [email protected] name=Clark

Here is the output from httpie

POST /api/v0/kajian/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 79578
Content-Type: multipart/form-data; boundary=3cad93334b304f30b555d85a0cbdb880
Host: myapi.com
User-Agent: HTTPie/0.9.9

plugin not working on ios

Here is the file path i'm passing
"ionic://localhost/_app_file_/var/mobile/Containers/Data/Application/967FEAEF-AC55-4DFF-95FE-E4FBAA06FC2D/tmp/cdv_photo_001.jpg"
Here's the error i'm getting.
"ERROR" { [ng] "line": 25, [ng] "column": 29, [ng] "sourceURL": "http://192.168.25.175:8100/plugins/com-badrit-base64/www/Base64.js" [ng] }

Image File URI does not converted in IOS

I'm trying to convert from image file_uri to base64 but xcode return an error :
errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

PDF files not converted into base 64

Hi,
I am using your ionic 2 plugin it works fine to convert images on but when i try to convert a pdf file it does not convert a pdf file please help.

Ionic convert mp4 file to base64, and I get empty result from console.log

I used media capture plugin and tried to get my media video file path, but the inside result doesn't get anything. Here is my code in below.

  const options: CaptureVideoOptions = { duration: 5, quality: 50 };
    this.mediaCapture.captureVideo(options).then(
      (data: MediaFile[]) => {

        let fileName = data[0].fullPath.split('/').pop();
        let path = data[0].fullPath.substring(0, data[0].fullPath.lastIndexOf("/") + 1);
        console.log('this is path '+path)

        let filePath: string = data[0].fullPath;
        console.log('full path '+ filePath);

        if (this.device.platform == 'Android') {
          this.base64.encodeFile(filePath).then((base64File: string) => {
            console.log('after convert '+ base64File);
          }, (err) => {
            console.log('error message ' + err)
          })
        }
      }
    );

Issue on IOs

an attempt was made to break through the security policy of the user agent

Not working in iOS

It was working fine until recently, I followed the steps here but the following code does not work.

this.base64.encodeFile(filePath).then((base64File: string) => { console.log(base64File); }, (err) => { console.log(err); });

The above code does not work.

Return empty string in Android 11

could not working base64.encodeFile
android-minSdkVersion: 22
android-targetSdkVersion: 30

filePath = file:///storage/emulated/0/Download/Small.pdf
this.base64.encodeFile(filePath ).then(async (base64File: string) => {
console.log("==base64File==", base64File)
}, (err) => { });

Got the log "==base64File=="

Corrupt pdf base64 URL for android version > 7.0

It is working fine for android version lower than 7. When i use on android 8 or 9 pdf is not downloaded.When i debug the source i found corrupt base 64 url. Please help as i am working on a project needs to deliver as soon as posible.

I am not receiving the base64

Hi. I have the following code:

let filePath: string = 'file:///storage/6E55-1102/DCIM/Camera/20180704_143914.jpg'; this.base64.encodeFile(filePath).then((base64File: string) => { console.log("ssssss" + base64File); }, (err) => { console.log("err"); });

It prints 'sssss' but nothing else. I'm trying to use it for android 6.3.0

What can I do? Thanks.

Image converted but wrong

Hello,
i'm using this plugin but i have a problem. The plugin returns a BASE64 string for an image but if i try to show this image in an img html tag nothing is showed. I have tried also with online tools to show base64 images and i receive this error: "corrupted image".

What i'm wrong?

Thanks.

SecurityError

SecurityError (DOM Exception 18): The operation is insecure

Not work in IOS11

SecurityError: The operation is insecure

this.base64.encodeFile(this.images[i]) .then( (base64File: string) => { this.loadingImages[i] = false; document.querySelector(#image${i}).setAttribute('src', base64File) }, (err) => { this.loadingImages[i] = false; this.telocambioService.presentToast('Hubo un error al cargar la imagen, intenta de nuevo.') } )

I am trying convert a image to Base64 in iOS, y I am getting this error:
SecurityError " return canvas.toDataURL();

Phonegap Build Uncaught ReferenceError: device is not defined Base64.js:11

Hello. Testing on Android to convert a file the Uncaught Reference error is raised on line 11:
I am using PhoneGap Build version 5.2.0

       args.filePath = filePath;
    //handle android using native code because toDataURL is not supported on android version < 3
    if (device.platform == "Android") //Error is raised here
        cordova.exec(sucess, failure, "Base64", "encodeFile", [args]);
    else{

This is my code:

            var url = photos[i][0];
            var description = photos[i][1];
            window.plugins.Base64.encodeFile(url, function (base64) {
                var postData = {
                    'filex': base64,
                    'order': theOrder,
                    'des': description
                }
                console.log(postData);
                $.ajax({
                    url: apiip + 'pictures',
                    headers: {
                        "api-key": apiKey,
                        "shop-id": shopID
                    },
                    type: 'POST',
                    data: postData,
                    success: function (data) {
                        console.log(data);
                    },
                    error: function (xhr, status, e) {
                        console.log(e);
                    }
                });
                console.log("sent ajax request");
            });

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.