Closed nantunes closed 8 years ago
Hi @schreyers
I'm still using my forked version, as this PR hasn't been merged (or even reviewed).
If it is critical to your project, you probably better applying this fix yourself.
Thanks @nantunes
I'll make your changes to the files and remove the source="npm" from my config file.
Hi @nantunes
Quick question. Are you able to use your forked version when using build.phonegap.com? If not how are you using your changes?
Thanks in advance,
I'm using the lastest versions of cordova with ionic framework. I build locally. No phonegap-build, so I can't tell.
Sorry for the delayed reply. Have been trying to build locally but i get loads of errors.
I really need this to be fixed in the npm version of the plugin.
@nantunes, thanks for contribution. Could you please rebase your changes.
Also please file an Apache CLA as described in CONTRIBUTING.md
Ok, will do it this night.
Rebased and ICLA sent by email.
Yep, see it now. Merging. Thanks for contribution, @nantunes!
Has anyone tested this patch? Applying the changes to CameraLauncher.java results in failed getPicture
calls. Unfortunately the only error is "Error retrieving image", so I'm not sure where it breaks.
I also tried building from the nightlies and get the same error. When I revert ouputModifiedBitmap
in the nightlies the error goes away.
Per se the patch only manipulates strings:
String fileName = realPath != null ?
realPath.substring(realPath.lastIndexOf('/') + 1) :
"modified." + (this.encodingType == JPEG ? "jpg" : "png");
String modifiedPath = getTempDirectoryPath() + "/" + fileName;
So I don't how could it cause that error. Maybe some other change in-between? Could you diff the two versions of CameraLauncher.java?
Debugging shows that FileHelper.getRealPath
returns an empty (non-null) string, which causes the function to return a directory name instead of a file name.
/storage/emulated/0/Android/data/com.ionicframework.ws938141/cache: open failed: EISDIR (Is a directory)
// Some content: URIs do not map to file paths (e.g. picasa).
String realPath = FileHelper.getRealPath(uri, this.cordova);
// Get filename from uri
String fileName = realPath != null ?
realPath.substring(realPath.lastIndexOf('/') + 1) :
"modified." + (this.encodingType == JPEG ? "jpg" : "png");
Adding a check for empty string fixed the issue for me
String fileName = (realPath != null && !realPath.isEmpty()) ?
and
if (realPath != null && !realPath.isEmpty() && this.encodingType == JPEG) {
that issue is still there in camera plugin
can someone plz tell how to solve this issue for ionic 4
Please open a new issue and fill the template instead of abusing an old and already merged PR.
Hi Nantunes,
Did you manage to use the realpath filename and if sodo you know when it will be added to the npm version on phonegap? There is a current bug which means images get uploaded as duplicates because of the file name still being modified.jpg for all the edited images.
https://stackoverflow.com/questions/30438483/cordova-image-upload-duplicate-issue#
I have recently re-added the plugin but I still get the issue that edited images are called modified.jpg.
Thanks, Jon