{"action":"created","issue":{"url":"https://api.github.com/repos/Yalantis/uCrop/issues/173","repository_url":"https://api.github.com/repos/Yalantis/uCrop","labels_url":"https://api.github.com/repos/Yalantis/uCrop/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/Yalantis/uCrop/issues/173/comments","events_url":"https://api.github.com/repos/Yalantis/uCrop/issues/173/events","html_url":"https://github.com/Yalantis/uCrop/issues/173","id":171061132,"number":173,"title":"empty bitmap file creation","user":{"login":"mtkarimi","id":3770570,"avatar_url":"https://avatars.githubusercontent.com/u/3770570?v=3","gravatar_id":"","url":"https://api.github.com/users/mtkarimi","html_url":"https://github.com/mtkarimi","followers_url":"https://api.github.com/users/mtkarimi/followers","following_url":"https://api.github.com/users/mtkarimi/following{/other_user}","gists_url":"https://api.github.com/users/mtkarimi/gists{/gist_id}","starred_url":"https://api.github.com/users/mtkarimi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtkarimi/subscriptions","organizations_url":"https://api.github.com/users/mtkarimi/orgs","repos_url":"https://api.github.com/users/mtkarimi/repos","events_url":"https://api.github.com/users/mtkarimi/events{/privacy}","received_events_url":"https://api.github.com/users/mtkarimi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-14T14:22:27Z","updated_at":"2016-08-16T16:24:30Z","closed_at":null,"body":"*bug*  :sob: \r\n@Yalantis\r\n**This bug is shown when:**\r\n1- we chose an image from google drive app.\r\n2- we chose an image from external sd card.\r\n\r\n**Waz goin on:**\r\n1- we open the app\r\n2- we chose an image from gdrive, here two things will happen\r\n     1- if we crop the image, its okay and it will work because ucrop copy the bitmap into where we set\r\n     2- if we do not crop it, it will not work cuz the app didnt copy the image into the path we set as default, i was looking at the source code, if we dont crop the app will say: cropped needed? false. then its just create an empty bitmap file and will load that empty file.\r\n\r\n**Solution i Think:**\r\nthis is what i think is right, for the files on internal or some external cards the behaviour is right and works well, but on some devices and gdrive files will not work, but this idea i have maybe can be helpful.\r\n\r\n1- if we do not crop, u crop should copy the selected image into the path we set in any situation.\r\n2- or put an option to ask the user, do you want to copy or use the original?\r\n\r\n\r\n\r\n**and here is the stacktrace:**\r\n`onFailure: setImageUri\r\n                                                                               java.lang.IllegalArgumentException: Bounds for bitmap could not be retrieved from the Uri: [file:///data/user/0/com.yalantis.ucrop.sample/cache/SampleCropImage.jpg]\r\n                                                                                   at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:113)\r\n                                                                                   at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:41)\r\n                                                                                   at android.os.AsyncTask$2.call(AsyncTask.java:295)\r\n                                                                                   at java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\n                                                                                   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)\r\n                                                                                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)\r\n                                                                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)\r\n                                                                                   at java.lang.Thread.run(Thread.java:818)`\r\n\r\n\r\n\r\n\r\n\r\n**and i think the bug is in the copying stage:**\r\nthe class BitmapCropTask.java\r\nline 148: _FileUtils.copyFile(mImageInputPath, mImageOutputPath);_\r\nbecause everything works fine if we comment:  `boolean shouldCrop = shouldCrop(width, height);`\r\nits not the solution but it can make it work because of the cropping solutions and...\r\n\r\nthe FileUtils.java: copyFile()... \r\ni didnt have time to look into the codes and find the main reason and best solution, but for now its good to know this kinda things is there.\r\n\r\n\r\nthanks a lot, ill be happy to know more about this."},"comment":{"url":"https://api.github.com/repos/Yalantis/uCrop/issues/comments/240156356","html_url":"https://github.com/Yalantis/uCrop/issues/173#issuecomment-240156356","issue_url":"https://api.github.com/repos/Yalantis/uCrop/issues/173","id":240156356,"user":{"login":"PGMacDesign","id":6592650,"avatar_url":"https://avatars.githubusercontent.com/u/6592650?v=3","gravatar_id":"","url":"https://api.github.com/users/PGMacDesign","html_url":"https://github.com/PGMacDesign","followers_url":"https://api.github.com/users/PGMacDesign/followers","following_url":"https://api.github.com/users/PGMacDesign/following{/other_user}","gists_url":"https://api.github.com/users/PGMacDesign/gists{/gist_id}","starred_url":"https://api.github.com/users/PGMacDesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PGMacDesign/subscriptions","organizations_url":"https://api.github.com/users/PGMacDesign/orgs","repos_url":"https://api.github.com/users/PGMacDesign/repos","events_url":"https://api.github.com/users/PGMacDesign/events{/privacy}","received_events_url":"https://api.github.com/users/PGMacDesign/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T16:24:30Z","updated_at":"2016-08-16T16:24:30Z","body":"I believe this is related to the copy utils bug. If so, I wrote a fix for it a week ago and am still waiting for the devs to merge the branch/ code...."}}
{"actor":{"display_login":"PGMacDesign"}}