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

[BUG] - No crop option after camera #24

Closed
rexyrex opened this issue Jan 4, 2021 · 11 comments · Fixed by #27
Closed

[BUG] - No crop option after camera #24

rexyrex opened this issue Jan 4, 2021 · 11 comments · Fixed by #27
Milestone

Comments

@rexyrex
Copy link

rexyrex commented Jan 4, 2021

Issue:
When selecting the default "camera" option, app does not go to crop screen after taking photo.

  • Open selection menu
  • Select camera
  • Opens camera
  • Take picture
  • "Select or retake?" menu
  • On selecting "select", camera closes and nothing happens

Expected Behavior

  • Open Selection menu
  • Select Camera
  • Opens camera
  • Take picture
  • "Select or Retake?" menu
  • On selecting "select" crop view opens

Device
Android 10.
Galaxy Note 10+
implementation 'com.canhub.cropper:android-image-cropper:1.1.1'

Code used to open selector
CropImage.activity().setGuidelines(CropImageView.Guidelines.ON).setAspectRatio(1,1).start(activity);

Extra Info

  1. (This used to work with the original library)
  2. Selecting photo from "Files" correctly opens crop view
@rexyrex rexyrex added the bug label Jan 4, 2021
@bohemima
Copy link

bohemima commented Jan 4, 2021

Error seems to be "Failed to load sampled bitmap: content://package.cropper.fileprovider/my_images/Pictures/pickImageResult8398353326702376456.jpeg"

Is there missing steps in the documentation for FileProvider or permissions perhaps?

@VEIKKO99
Copy link

VEIKKO99 commented Jan 4, 2021

I'm experiencing exactly the same bug. Code seems to fail here:
BitmapFactory.Options decodeImageForOption(ContentResolver resolver, Uri uri)

==> This check fails in BitmapSampled decodeSampledBitmap(Context context, Uri uri, int reqWidth, int reqHeight) method:
if (options.outWidth == -1 && options.outHeight == -1) throw new RuntimeException("File is not a picture");

Bug is reproducible only when using the camera. Choosing a image from gallery works fine.

@Canato
Copy link
Member

Canato commented Jan 4, 2021

@rexyrex I have another bug, but similar. When I try to run Quick Sample the camera option is not available, even if the permission is granted.
Will look in to this bug later, in the main time I tag as help wanted and good first issue if someone else jump to help us.

@bohemima your problem seen unrelated, but another one, please check this PR #10 where we did the FileProvider work. Should be fine, but maybe we hit another issue, let me know please

@VEIKKO99 could you get the same issue running the code Quick Sample build?

@Canato Canato added the pinned label Jan 4, 2021
@Canato Canato added this to the v_1.2.0 milestone Jan 4, 2021
@bohemima
Copy link

bohemima commented Jan 5, 2021

@rexyrex I have another bug, but similar. When I try to run Quick Sample the camera option is not available, even if the permission is granted.

Only did a quick look around but it seems it is missing queries decleration for IMAGE_CAPTURE in the manifest,

    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>

@bohemima your problem seen unrelated, but another one, please check this PR #10 where we did the FileProvider work. Should be fine, but maybe we hit another issue, let me know please

I'm pretty sure it's the same issue, the crop screen is shown briefly before closing and the above error is sent.

@Canato
Copy link
Member

Canato commented Jan 5, 2021

Great! =D
@bohemima any chance you can help here? Try to reproduce on the sample apps and propose a fix(PR)?

@VEIKKO99
Copy link

VEIKKO99 commented Jan 5, 2021

@VEIKKO99 could you get the same issue running the code Quick Sample build?

I'm not sure what you mean by Quick Sample build, but the error also occurs on the sample app.

@Sophie713
Copy link

Sophie713 commented Jan 8, 2021

SVID_20210108_153601_1.mp4

We are having the same issue. After you take the picture instead of offering to crop it it returns back to my activity.
Seems to be an issue on all Android 10 devices we have tried.

@jmcrox
Copy link
Contributor

jmcrox commented Jan 12, 2021

I think this bug may be the same as #21 because when the CropImageActivity returns from camera (onActivityResult) the cropImageUri is initialized through CropImage.getPickImageResultUri(this, data) which results in CropImage.getCaptureImageOutputUri(context). Then the cropImageUri points to empty file (#27 ).

@rexyrex
Copy link
Author

rexyrex commented Jan 14, 2021

Version 2.0.0 fixed the issue for me. Camera -> crop now works

@Canato Canato linked a pull request Jan 14, 2021 that will close this issue
@Canato Canato closed this as completed Jan 14, 2021
@SaltyBoi31
Copy link

Version 2.0.0 fixed the issue for me. Camera -> crop now works

I have the same issue, but on Android 11. What change did Version 2.0.0 bring to fix the issue? (android noobie here)

@Canato
Copy link
Member

Canato commented Jan 18, 2022

Hey @SaltyBoi31 try to use the latest library version and open a new issue (following the template) so I can help better ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants