jamesmontemagno / MediaPlugin

Take & Pick Photos and Video Plugin for Xamarin and Windows
MIT License
712 stars 357 forks source link

[Question]Pickphotoasync and takephotoasync is saving a copy of image in temp folder for android #441

Open hunii opened 6 years ago

hunii commented 6 years ago

On Android,(not yet tested on IOS)

1, PickPhotoAsync(option: null) 2, TakePhotoAsync(option: SaveToAlbum = false;)

Is there a reason why 1, 2 is saving a COPY of the image by taken or picked in the below directory?

"/storage/emulated/0/Android/data/company_name/files/Pictures/temp/***.jpg"

I have not specified to save or even temporarily save in any directory. App size is increasing every time image is picked from gallery or album; or taken using camera.

I could just navigate into and manually delete them after taken or picked but just want to raise and see if any other solution is available

Thanks

Brosten commented 6 years ago

I just noticed the same thing on iOS. Not sure if a temp copy is saved, but each time i pick a photo from the gallery or taking a photo, the disk-space used by my app is increased by 2-4MB. This space is never "returned". Users of my app takes pretty much photos, so this does pretty fast gives them the situation where my app takes hundreds of MB or even a couple of gigabytes.

Is there a way to avoid this?

hunii commented 6 years ago

@Brosten What I did was that I created DependencyService to FilIO and remove that particular files in each platform. One of the reason for delete for me was that my app is handling files as byte[] rather read/write from file. So I dont actually need to use the file. If you need to save them locally but in different location, you can just move the file to the location you need

Brosten commented 6 years ago

Ahh, of course. I solved it the same way now, thanks!

rob-byram commented 4 years ago

@Brosten I have a dependency service to remove the photo files, but it still does not appear to be "returning" my space. I'm on Android, but the idea should be the same. Did you have to go through any special hoops to ensure the files were deleted and the space returned?

rob-byram commented 4 years ago

Never mind. My issue appears to be that the Samsung TabActive2 tablet is slow to clean up and return the space. Testing on two other devices, their data numbers shrink appropriately in short order.