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

How to use CropImageView in Compose? #596

Closed
phongbm opened this issue Oct 30, 2023 · 3 comments
Closed

How to use CropImageView in Compose? #596

phongbm opened this issue Oct 30, 2023 · 3 comments

Comments

@phongbm
Copy link

phongbm commented Oct 30, 2023

I want to use CropImageView in Compose project, how to do that?

@Pantsoffski
Copy link

Like this:

val cropImage = rememberLauncherForActivityResult(CropImageContract()) { result -> if (result.isSuccessful) { // Use the returned uri. val uriContent = result.uriContent val uriFilePath = result.getUriFilePath(context) // optional usage } else { // An error occurred. val exception = result.error } }

and start with e.g. this:

cropImage.launch( CropImageContractOptions( uri = null, cropImageOptions = CropImageOptions( imageSourceIncludeGallery = true, imageSourceIncludeCamera = false, fixAspectRatio = true // aspectRatioX = 1, // aspectRatioY = 1, ) ) )

@hoangchungk53qx1
Copy link

@vanniktech
Copy link
Contributor

Seems like there is a solution. We don't have official Compose support, but I'm willing to take PRs that either improve the overall component / provide a proper Compose support.

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

4 participants