question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returning original image using NATIVE_URI, instead of stripped copy

See original GitHub issue

The plugin works great. However, it creates a copy of the image file for further processing. This strips out the original metadata of the image, like the EXIF details. Is it possible to not create a copy, and simply return theCamera.DestinationType.NATIVE_URI instead?

By using the NATIVE_URI, the original file (path) is returned - e.g., assets-library:// on iOS or content:// on Android - and allows processing of the native file, including EXIF data. This has also been fixed in recent Cordova updates, so it’s obvious this hasn’t been used before.

Ideally, an option like for example useOriginal: true, or the quality: 100 to preserve backwards compatability would be a nice solution in my opinion,.

@wymsee: I’m also interested in digging through the code here a bit, but would love some input if this is advisable (and perhaps a bit of a tip where to fix this). Any tips?

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:5
  • Comments:31

github_iconTop GitHub Comments

1reaction
pixxiocommented, Jul 9, 2015

This is completely untested code, but maybe it helps you:

window.imagePicker.getPictures(
  function(results) {
    console.log('start!');
        function loopThroughImages(i) {
            if (i < results.length) {
                var origURI = results[i];
                var tmpURI = results[i+1];

                var options = new FileUploadOptions();
                options.fileKey = "file";
                options.fileName = "myTestUpload_"+i+".jpg";
                options.mimeType = "image/jpeg";
                options.chunkedMode = false;

                var params = {};
                params.keywords = 'mobile,upload';
                options.params = params;

                var transfer = new FileTransfer();
                transfer.upload(
                    origURI,
                    encodeURI('PATH/TO/MY/UPLOADSCRIPT'),
                    function(response) {
                        console.log('it worked!');

                            i = i+2;
                            loopThroughImages(i);
                    },
                    function(error) {
                        console.log('ERROR FILEUPLOAD');
                        console.log("An error has occurred: Code = " + error.code);
                        console.log("upload error source " + error.source);
                        console.log("upload error target " + error.target);
                    },
                    options
                );
            }
            else {
                console.log('done!');
            }
        }
        loopThroughImages(0);
  }, function (error) {
    console.log('Error: ' + error);
  }, {
    maximumImagesCount: 50
  }
);
0reactions
lopradicommented, Oct 4, 2016

@DanceSC you have to update the updateAcceptButton method of MultiImageChooserActivity.java to enable if there are images selected. This is the code that works:

private void updateAcceptButton() {

    ((TextView) getActionBar().getCustomView().findViewById(fakeR.getId("id",  "actionbar_done_textview"))).setEnabled(fileNames.size() != 0);

    getActionBar().getCustomView().findViewById(fakeR.getId("id", "actionbar_done")).setEnabled(fileNames.size() != 0 );        

}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert FILE_URI to NATIVE_URI or vice versa in ionic 3
I am using cordova Camera plugin to get image from gallery, in IOS ... to server all the meta-data attached to the image...
Read more >
[Resolve]-Stomped on a "EXC_BAD_ACCESS ... - appsloveworld.com
I have production code which I see that it crashes once in a while with a EXC_BAD_ACCESS KERN_INVALID_ADDRESS on the block handler. I...
Read more >
How Do I Strip an Image in Photoshop? - website builder
To use a Layer Mask, first create a new layer. Then, on the new layer, use either the Clone Stamp tool or the...
Read more >
Read data from specified strip - MATLAB readEncodedStrip
This MATLAB function returns the image data from the strip specified by stripNumber from the TIFF file represented by the Tiff object t....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found