Vishal Thakur
Vishal Thakur

Reputation: 29

How to use CanHub image cropper library, Getting error in my code

enter image description hereGetting error in options unable to import options, i tried dhaval but its also not working i'm using kotlin dsl using gradle 8.4

implementation("com.vanniktech:android-image-cropper:4.5.0")
  private val cropImage = registerForActivityResult(CropImageContract()) { result ->
    if (result.isSuccessful) {
      val uriContent = result.uriContent
      val uriFilePath = result.getUriFilePath(context) 
    } else {
      val exception = result.error
    }
  }

  private fun startCrop() {
    cropImage.launch(
      options {
        setGuidelines(Guidelines.ON)
      }
    )

   activity.
    cropImage.launch(
      options {
        setImagePickerContractOptions(
          PickImageContractOptions(includeGallery = true, includeCamera = false)
        )
      }
    )
    cropImage.launch(
      options(uri = imageUri) {
        setGuidelines(Guidelines.ON)
        setOutputCompressFormat(CompressFormat.PNG)
      }
    )

Upvotes: 0

Views: 65

Answers (0)

Related Questions