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

I Impliment Crop Functionality With useing External Library -> implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' #299

Closed
Kishan7up opened this issue Dec 23, 2020 · 2 comments

Comments

@Kishan7up
Copy link

Kishan7up commented Dec 23, 2020

You Can Use This Library In Tap Of Upload Image Case :
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'

  1. Manifest :

  2. Add This Line in Switch-case : PICK_REQUEST/ CAMERA_REQUEST:
    CropImage.activity(uri)
    .setGuidelines(CropImageView.Guidelines.ON)
    .start(this);

  3. if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
    CropImage.ActivityResult result = CropImage.getActivityResult(data);
    if (resultCode == RESULT_OK) {
    Uri resultUri = result.getUri();
    Bitmap bitmap = null;
    try {
    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), resultUri);
    mPhotoEditorView.getSource().setImageBitmap(bitmap);

            } catch (IOException e) {
                e.printStackTrace();
            }
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
        }
    }
    
@burhanrashid52
Copy link
Owner

Thanks for the issue. I will link this to #79 and will close this one.

@sahil0289
Copy link

You Can Use This Library In Tap Of Upload Image Case : implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'

  1. Manifest :
  2. Add This Line in Switch-case : PICK_REQUEST/ CAMERA_REQUEST:
    CropImage.activity(uri)
    .setGuidelines(CropImageView.Guidelines.ON)
    .start(this);
  3. if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
    CropImage.ActivityResult result = CropImage.getActivityResult(data);
    if (resultCode == RESULT_OK) {
    Uri resultUri = result.getUri();
    Bitmap bitmap = null;
    try {
    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), resultUri);
    mPhotoEditorView.getSource().setImageBitmap(bitmap);
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
        }
    }
    

How did you crop image after highlighting or writing text??

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

No branches or pull requests

3 participants