Skip to content
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

return cropped image width/height in onActivityResult #149

Closed
suau opened this issue Jul 8, 2016 · 5 comments
Closed

return cropped image width/height in onActivityResult #149

suau opened this issue Jul 8, 2016 · 5 comments

Comments

@suau
Copy link

suau commented Jul 8, 2016

it would be great if the cropped ActivityResult would contain the final cropped image width and height as well, the data is already available in BitmapCropTask and just needs to be passed through to the BitmapCroppedCallback.

As none of the internals are exposed by this library, I think it's acceptable to change the interface of BitmapCroppedCallback.

@Mrxxy
Copy link

Mrxxy commented Sep 7, 2016

need it, too. Because i just need the final cropped Rect,so will you support it ? Thanks.

@shliama
Copy link
Contributor

shliama commented Sep 8, 2016

Thanks for the issue. I've added this info to the ActivityResult bundle, available in the next library update soon.

@shliama
Copy link
Contributor

shliama commented Sep 8, 2016

Please check the latest uCrop version :octocat:
Now you can choose between:

Lightweight general solution
compile 'com.yalantis:ucrop:2.2.0' 
Get power of the native code to preserve image quality (+ about 1.5 MB to an apk size)
compile 'com.yalantis:ucrop:2.2.0-native'

@Mrxxy
Copy link

Mrxxy commented Sep 9, 2016

@shliama I have download the latest version and tested,it works well.Thank you.
Here is what i add for the new api:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
        int width = data.getIntExtra(UCrop.EXTRA_OUTPUT_IMAGE_WIDTH, defaultValue);
        int height = data.getIntExtra(UCrop.EXTRA_OUTPUT_IMAGE_HEIGHT, defaultValue);
    } else if (resultCode == UCrop.RESULT_ERROR) {
       Throwable cropError = UCrop.getError(data);
    }
}

@TeeRawk
Copy link
Contributor

TeeRawk commented Mar 13, 2017

resolved

@TeeRawk TeeRawk closed this as completed Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants