zetbaitsu / Compressor

An android image compression library.
7.08k stars 963 forks source link

Should accept Uri as well #18

Open irfaan008 opened 7 years ago

irfaan008 commented 7 years ago

It should also accept Uri as a parameter. I tried converting my Uri into file and then passed it. It shows error "Image not found". Another line was saying "image width and height should not be less than 0".

Library shouldn't crash if someone is passing bad file. It should be capable to handle the same if it suggests possible root cause then that would be appreciable.

Phocacius commented 7 years ago

actually the library accepts a File as parameter just to convert it into a Uri right away. Adding another method accepting a Uri should be no problem. I'll check it out and open a pull request if it works.

Phocacius commented 7 years ago

unfortunately you can not just pass an URI in the form content://com.android.providers.media.documents/document/image:xxxxx. It produces the same error. As a workaround, I'm using this solution to get the actual path now. Still, this could be implemented in the library. @zetbaitsu Should I attempt to integrate it in the library and create a PR?