lyft / scissors

✂ Android image cropping library
https://eng.lyft.com/scissors-an-image-cropping-library-for-android-a56369154a19
Apache License 2.0
1.84k stars 235 forks source link

Question - Is it possible to load image from camera and not only from Gallery? #5

Closed davidbeloo closed 8 years ago

lexer commented 8 years ago

@davidbeloosesky

cropView.setImageBitmap(yourBitmapFromCamera)

or

cropView.extensions()
.load(yourFileFromCamera)
rohanmahale commented 8 years ago

Hi @davidbeloosesky

I am trying to load an image into the cropview but it does not show up. I pass a string extra to my crop image activity.

I then try to load it into the cropview using the following

@AfterViews
void setupUI() {
    if (getIntent().getExtras() != null) {
        if (getIntent().getExtras().getString(KEY_IMAGE_FILE_PATH) != null) {
            cropView.extensions()
                    .load(Uri.fromFile(new File(getIntent().getStringExtra(KEY_IMAGE_FILE_PATH))));

        }
    }

}

The value of the string on debugging is

/storage/emulated/0/Pictures/PrismApp/Current/96adeca7-79a3-4cf9-bc1c-8c736bb26ee2.jpg

Why does the image not show up? Am I using the api wrong or is it a bug?

eveliotc commented 8 years ago

@davidbeloosesky as @lexer demonstrated you can only load Bitmaps from a model e.g. a File, Uri, String, etc. We don't have a camera view at the moment.

@rohanmahale there is no need for Uri.fromFile part just providing a File should suffice, also make sure you have read permission. Please create a separate issue if you still can't load your file.