Drjacky / ImagePicker

📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼
https://github.com/Drjacky/ImagePicker
Apache License 2.0
233 stars 57 forks source link

[Help Wanted] Is there a way to get the exact extension of the file regardless of the storage? #56

Open mjini-dev opened 2 years ago

mjini-dev commented 2 years ago

I'm using the library you provided well. I am contacting you because there is a difficulty in using the library.

My service allows users to select whether to import only gif files or not except gif files, and then take image files from the gallery and send photo files and MIMETYPE to the server.

The problem here is that the name of the file comes differently depending on where the file is imported (there are two places, 'Images_No. 1 in the attached image' and 'Downloads_No. 2 in the attached image' for my phone).

As a result of my own analysis, when imported through 'Images', the gif file name comes the same as the name of the existing file in the flow of <getPathFromLocalUri(), whereas the gif file name comes in the same way as the name of the existing file. Imported through 'Downloads' takes the flow of <getPathFromRemoteUri()>, and the file name comes in the form of <valueFileName="IMG_${getTimestamp()}$ext" in <getImageFile()>, and the extension is transformed into jpg.

Is there a way to get the exact extension of the file regardless of the storage?

20211123_150954

Drjacky commented 2 years ago

Please try setOutputFormat from 2.3.17 and let me know if it helped in your case or not.

https://github.com/Drjacky/ImagePicker/issues/51