Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Plugin - Android - Camera.getPhoto() is saving a permanent copy that can't be deleted, even with saveToGallery set to false #497

Closed
pabloservin opened this issue Jun 24, 2021 · 3 comments

Comments

@pabloservin
Copy link

Bug Report

Plugin(s)

@capacitor/camera: 1.0.1

Capacitor Version

Latest Dependencies:       

  @capacitor/cli: 3.0.2    
  @capacitor/core: 3.0.2   
  @capacitor/android: 3.0.2
  @capacitor/ios: 3.0.2    

Installed Dependencies:    

  @capacitor/ios: not installed
  @capacitor/cli: 3.0.1    
  @capacitor/android: 3.0.1
  @capacitor/core: 3.0.1

Platform(s)

Android

Current Behavior

When you use the Camera.getPhoto() function with the options:

  quality: 50,
  source: CameraSource.Camera,
  saveToGallery: false,
  resultType: CameraResultType.Uri,

The returned photo object contains the "path" property: file:///data/user/0/io.ionic.starter/cache/JPEG_20210624_085255_5425877611720472711.jpg

This path I use to delete the file, when needed, using the Filesystem.deleteFile(), which indeed deletes the file. But if I check my DCIM/Camera folder the image is still there and showing in my gallery.

Expected Behavior

If the option saveToGallery is set to false, then it shouldn't save the image, or it shouldn't create a permanent copy.

Code Reproduction

I created a simple repo ionic + capacitor: https://github.com/pabloservin/capacitor-camera-test
There's a button in the home page that takes a picture and after 2.5 seconds the image is deleted using Filesystem.

Other Technical Details

Additional Context

Related or similar issues:
#431
#212
https://stackoverflow.com/questions/63398598/ionic-capacitor-camera-delete-image

@jcesarmobile
Copy link
Member

jcesarmobile commented Aug 24, 2021

I've sent a PR that deletes unneeded images #563, but not sure if it would solve your problem, looks like that on some devices the camera app creates a copy of the file. Sadly there is nothing we can do about it.

@pabloservin
Copy link
Author

@jcesarmobile ok, bit late, but thanks anyway!

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 30, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants