-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
[BUG] - Getting uriContent as null in CropImageView.CropResult #180
Comments
Hey @cybertronjc thanks for the detailed issue, helps a lot to understand your case. This is our sample code using crop image view Maybe it can help. You said:
But this method should no return any result. did you override Hope this piece of code can help: private fun handleCropResult(result: CropResult?) {
if (result != null && result.error == null) {
val imageBitmap =
if (binding.cropImageView.cropShape == CropImageView.CropShape.OVAL)
result.bitmap?.let { CropImage.toOvalBitmap(it) }
else result.bitmap
context?.let { Log.v("File Path", result.getUriFilePath(it).toString()) }
SCropResultActivity.start(this, imageBitmap, result.uriContent, result.sampleSize)
} else {
Log.e("AIC", "Failed to crop image", result?.error)
Toast
.makeText(activity, "Crop failed: ${result?.error?.message}", Toast.LENGTH_SHORT)
.show()
}
}
``` |
Hey @Canato this is the centered check image (refer screenshot). On click of this check image I am calling cropImageView.getCroppedImageAsync(). and receiving the result in onCropImageComplete.
I have implemented the override function onCropImageComplete like this.
Still I get the uriContent as null but I am receiving the Bitmap which I don't want to use. check the debug screenshot below |
Interesting bug, we need to take a look. What are you receiving from the UriFilePath? And can you reproduce on the sample code? |
Hey @Canato Allow me some time to reproduce it on the sample code. |
I fix the scope storage last November. But let's keep investigating, I'm going for the weekend, but back on Monday |
Hey @Canato |
Found it, is not exactly a bug, but something this library need improvement, since we come from Java, we have strange stuff and not so good documentation, like For getting The library activity For sure something that need refactor @@. |
Besides the fact we can use without any change, the code can be refactor and improve. I'm working on this here: #185 Something still wrong, so is a draft by now. |
Hey @Canato |
Hey @cybertronjc the PR is WIP state, not ready yet =D |
Cool, No worries. As of now I have changed the default compression format to PNG. After that I am not getting the blurred image. thanks |
Hey @Canato , when this will be fixed? I'm in the middle of the development process, suffering with same bug. |
@Avishek1989 Hi I was also in the development process. I imported the library as a module and changes the files which @Canato has updated in the PR. |
Hey @Avishek1989 welcome =D
Important to make clear that I don't win anything with this library, I just handover the project because was without update for too long and is very useful. That said I do my best to fix the bugs and add features when I have time. But a lot of important contributions come from the community it self. Sadly I cannot answer you with a deadline so I don't commit to something I may not be able to keep. I mostly need to focus on my job that pays me hahahah (but we have the sponsor button in this library for this) In other vision, please feel free to open the PR and suggest a solution for the case, I will take the time to review and we merge, like many others did already, what make our lib better and better. Right know you can do a workaround like I suggest here or can use the default library activity until this is improved. I maybe have time this weekend after pack some boxes (I'm on moving houses process) |
🚨🚨 Before open the ticket please check if you can reproduce the bug in the sample code
Describe the bug
I have created a custom activity which includes CropImageView in my XML. Using DataBinding.
I am passing uri to cropImageView.setImageUriAsync(incomingUri) and getting uri in cropImageView.setOnSetImageUriCompleteListener().
For getting Cropped result I have used async method cropImageView.getCroppedImageAsync(), which gives me result in Bitmap but uriContent is Null.
Expected behavior
I should get the uriContent so that I can pass the uri back to fragment where I want to show the Cropped Image.
Media
When I click on the Center Check button I am calling cropImageView.getCroppedImageAsync()
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: