Giter Club home page Giter Club logo

imagepicker's Introduction

📸Image Picker Library for Android

Releases API Language PRWelcome FOSSA Status Android Arsenal Language

Easy to use and configurable library to Pick an image from the Gallery or Capture image using Camera. It also allows to Crop the Image based on Aspect Ratio, Resolution and Image Size.

‍🏍Features

  • Pick Gallery Images
  • Pick Images from Google Drive
  • Capture Camera Image
  • Crop Images(Crop image based on provided aspect ratio or let user choose one)
  • Compress Images(Compress image based on provided resolution and size)
  • Retrieve Image Result as File, File Path as String or Uri object
  • Handle Runtime Permission for Camera and Storage

🎬Preview

Profile Image Picker Gallery Only Camera Only

💻Usage

Gradle dependency:

	allprojects {
	   repositories {
	      	mavenCentral() // For ImagePicker library, this line is enough. Although, it has been published on jitpack as well
           	maven { url "https://jitpack.io" }  //Make sure to add this in your project for uCrop - an internal library
	   }
	}
   implementation 'com.github.Drjacky:ImagePicker:$libVersion'

Where $libVersion = libVersion

🎨Customization

If you want to get the activity result:

Kotlin

   private val launcher =
    registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
        if (it.resultCode == Activity.RESULT_OK) {
            val uri = it.data?.data!!
            // Use the uri to load the image
            // Only if you are not using crop feature:
            uri?.let { galleryUri ->
                contentResolver.takePersistableUriPermission(
                    uri, Intent.FLAG_GRANT_READ_URI_PERMISSION
                )
            }
            //////////////
        }
    }

Java

ActivityResultLauncher<Intent> launcher=
        registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),(ActivityResult result)->{
        if(result.getResultCode()==RESULT_OK){
        Uri uri=result.getData().getData();
        // Use the uri to load the image
        }else if(result.getResultCode()==ImagePicker.RESULT_ERROR){
        // Use ImagePicker.Companion.getError(result.getData()) to show an error
        }
        });

Both Camera and Gallery:

    ImagePicker.with(this)
    //...
    .provider(ImageProvider.BOTH) //Or bothCameraGallery()
    .createIntentFromDialog { launcher.launch(it) }

Crop image:

    .crop()

Crop image with 16:9 aspect ratio:

    .crop(16f, 9f)

Crop square image(e.g for profile):

    .cropSquare()    //Crop square image, its same as crop(1f, 1f)

Oval crop image:

    .crop()     
    .cropOval() //Allow dimmed layer to have a circle inside

Set Max Width and Height of final image:

    .maxResultSize(512, 512, true) //true: Keep Ratio

Java sample for using createIntentFromDialog:

ImagePicker.Companion.with(this)
        .crop()
        .cropOval()
        .maxResultSize(512,512,true)
        .provider(ImageProvider.BOTH) //Or bothCameraGallery()
        .createIntentFromDialog((Function1)(new Function1(){
public Object invoke(Object var1){
        this.invoke((Intent)var1);
        return Unit.INSTANCE;
        }

public final void invoke(@NotNull Intent it){
        Intrinsics.checkNotNullParameter(it,"it");
        launcher.launch(it);
        }
        }));

If you want just one option(camera or gallery):

    launcher.launch(
       ImagePicker.with(this)
           //...
           .cameraOnly() // or galleryOnly()
           .createIntent()
    )

Let the user to resize crop bounds:

        .crop()                                                  
        .cropFreeStyle()

Let the user to pick multiple files or single file in gallery mode:

        .setMultipleAllowed(true)

Let the user defines the output format:

        .setOutputFormat(Bitmap.CompressFormat.WEBP)

Intercept ImageProvider; could be used for analytics purposes:

ImagePicker.with(this)
        .setImageProviderInterceptor { imageProvider -> //Intercept ImageProvider
            Log.d("ImagePicker", "Selected ImageProvider: "+imageProvider.name)
        }
        .createIntent()

Intercept Dialog dismiss event:

    ImagePicker.with(this)
    	.setDismissListener {
    		// Handle dismiss event
    		Log.d("ImagePicker", "onDismiss");
    	}
    	.createIntent()

Limit MIME types while choosing a gallery image:

        .galleryMimeTypes(  //Exclude gif images
                    mimeTypes = arrayOf(
                      "image/png",
                      "image/jpg",
                      "image/jpeg"
                    )
                  )

Add Following parameters in your colors.xml file, if you want to customize uCrop Activity:

    <resources>
        <!-- Here you can add color of your choice  -->
        <color name="ucrop_color_toolbar">@color/teal_500</color>
        <color name="ucrop_color_statusbar">@color/teal_700</color>
        <color name="ucrop_color_widget_active">@color/teal_500</color>
    </resources>

💥Compatibility

  • Library - Android Kitkat 4.4+ (API 19)
  • Sample - Android Kitkat 4.4+ (API 19)

📃 Libraries Used

License

FOSSA Status

imagepicker's People

Contributors

benjaminlefevre avatar catlandor avatar dhaval2404 avatar douglas-srs avatar drjacky avatar fossabot avatar husseinhj avatar marchuck avatar mdxdave avatar soareseneves avatar terence-codigo avatar yamin8000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imagepicker's Issues

Add Intent Flags

Thanks for this library. Have you any idea how to allow the returned Uri as a persistable URI? I think it requires putting a flag in the startActivity Intent but I see no way to add flags.

requireActivity().grantUriPermission(
    requireActivity().packageName,
    fileUri,
    data.flags and
            Intent.FLAG_GRANT_READ_URI_PERMISSION and
            Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
requireActivity().contentResolver.takePersistableUriPermission(
    fileUri,
    data.flags and
            Intent.FLAG_GRANT_READ_URI_PERMISSION
)

Log:

    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=530587092, result=-1, data=Intent { dat=file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg (has extras) }} to activity {uk.co.imagitech.completetheorytestkit/uk.co.imagitech.learn2.passguarantee.PassGuaranteeClaimActivity}: java.lang.SecurityException: No persistable permission grants found for UID 10161 and Uri file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5015)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.SecurityException: No persistable permission grants found for UID 10161 and Uri file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
        at android.os.Parcel.createException(Parcel.java:2357)
        at android.os.Parcel.readException(Parcel.java:2340)
        at android.os.Parcel.readException(Parcel.java:2282)
        at android.app.IUriGrantsManager$Stub$Proxy.takePersistableUriPermission(IUriGrantsManager.java:280)
        at android.content.ContentResolver.takePersistableUriPermission(ContentResolver.java:2851)
        at uk.co.imagitech.learn2.passguarantee.ui.PassGuaranteeClaimFragment$onActivityCreated$1$1.invoke(PassGuaranteeClaimFragment.kt:58)
        at uk.co.imagitech.learn2.passguarantee.ui.PassGuaranteeClaimFragment$onActivityCreated$1$1.invoke(PassGuaranteeClaimFragment.kt:22)
        at com.github.drjacky.imagepicker.ImagePicker$Builder$startActivity$1.invoke(ImagePicker.kt:359)
        at com.github.drjacky.imagepicker.ImagePicker$Builder$startActivity$1.invoke(ImagePicker.kt:92)
        at com.github.florent37.inlineactivityresult.kotlin.Kotlin_activity_resultKt$sam$com_github_florent37_inlineactivityresult_callbacks_SuccessCallback$0.onSuccess(Unknown Source:2)
        at com.github.florent37.inlineactivityresult.InlineActivityResult.onReceivedActivityResult(InlineActivityResult.java:113)
        at com.github.florent37.inlineactivityresult.InlineActivityResult.access$000(InlineActivityResult.java:29)
        at com.github.florent37.inlineactivityresult.InlineActivityResult$1.onActivityResult(InlineActivityResult.java:45)
        at com.github.florent37.inlineactivityresult.ActivityResultFragment.onActivityResult(ActivityResultFragment.java:69)
        at androidx.fragment.app.FragmentManager$9.onActivityResult(FragmentManager.java:2889)
        at androidx.fragment.app.FragmentManager$9.onActivityResult(FragmentManager.java:2869)
        at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:344)
        at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:308)
        at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:618)
        at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
        at android.app.Activity.dispatchActivityResult(Activity.java:8310)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5008)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056) 
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7656) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

Could not find com.github.yalantis:ucrop:2.2.7

Getting a 'Not found' gradle error for ucrop on a kotlin project. Tried manually adding that to the gradle as well.

Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.yalantis:ucrop:2.2.7.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
       - https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
     Required by:
         project :app
   > Could not find com.github.yalantis:ucrop:2.2.7.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
       - https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
     Required by:
         project :app > com.github.Drjacky:ImagePicker:2.1.15

How do I use onActivity Result with this library?

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        when (resultCode) {
            Activity.RESULT_OK -> {
                val imageUri = data?.data
                iv_selectedimg.setImageURI(imageUri)
                fileUri = imageUri
            }
            ImagePicker.RESULT_ERROR -> {
                Toast.makeText(this, ImagePicker.getError(data), Toast.LENGTH_SHORT).show()
                finish()
            }
            else -> {
                Toast.makeText(this, "No Image Selected", Toast.LENGTH_SHORT).show()
            }
        }
    }

I was using this with Dhaval's Image Picker

select_image_for_post.setOnClickListener { ImagePicker.with(this) .maxResultSize( 2000,2000) .start() }

This does not seem to work, what changes should I do?

Fail to resolve ucrop

Describe the bug
Failed to resolve: com.github.yalantis:ucrop:2.2.7

To Reproduce
Steps to reproduce the behavior:

  1. Added maven { url "https://jitpack.io" } under repositories
  2. And implementation 'com.github.Drjacky:ImagePicker:2.1.14' under dependencies
  3. Build
  4. See error

Expected behavior
Should work just fine

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows 10

Want to pass custom request request code as shown in git document

Hi

what I am trying to do is in same page got 3 different images to capture,in latest version I am unable to pass request code in

   ImagePicker.Companion.with(this)
                        .crop()
                        .cropOval()
                        .maxResultSize(512, 512, true)
                        .createIntentFromDialog((Function1) (new Function1() {
                            public Object invoke(Object var1) {
                                this.invoke((Intent) var1);
                                return Unit.INSTANCE;
                            }
                            public final void invoke(@NotNull Intent it) {
                                Intrinsics.checkNotNullParameter(it, "it");
                                launcher.launch(it);
                            }
                        }));

I want to pass custom request code as show in your git document and on launcher I can capture as per request code shown below

 ActivityResultLauncher<Intent> launcher =
            registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), (ActivityResult result) -> {
                if (result.getResultCode() == RESULT_OK) {
                    //here I want to check request code so that I can use my logic
                } else if (result.getResultCode() == ImagePicker.RESULT_ERROR) {
                    // Use ImagePicker.Companion.getError(result.getData()) to show an error
                }
            });

image

Does this support for choose video and capture video?

The library is really well written also the documentation. I need to upload both image and video so.
Please provide the support for the video uploading from both gallery and camera. Not the compressed one for now, but better if it is also included.

Thank you.

Camera no work

  1. Camera no opening.
  2. cropOval() no work.

Version: 1.8.1

How to use on Java. Could you give some sample

Hi! A lot of thanks for your job!

I used before https://github.com/Dhaval2404/ImagePicker , but Google send a letter "We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs."

And I found your comments and your library, so...

My old code was:

private void avatarTouch() {
        ImagePicker.Companion.with(this)
                .crop(1f, 1f)
                .compress(1024)
                .maxResultSize(1080, 1080)
                .start();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == Activity.RESULT_OK) {

            Uri uri = data.getData();
            //File file = ImagePicker.Companion.getFile(data);
            //String filePath = ImagePicker.Companion.getFilePath(data);

            if (uri != null) {
                Picasso.get().load(uri).into(viewManager.avatarImageView);
            }

        } else if (resultCode == ImagePicker.RESULT_ERROR) {
            // Error
            Map<String, String> map = new HashMap<>();
            map.put("error", ImagePicker.Companion.getError(data));
            FirebaseModel.shared().sendAnalytics(MyApplication.context, "image_picker_error", map);

            Toast.makeText(MyApplication.context, ImagePicker.Companion.getError(data), Toast.LENGTH_LONG).show();
        } else {
            // Cancel
        }
    }

Could you please help me to change my code. I can't find an example on java how to use your library :(
Thanks!

No get 1.8.4

I can't get version 1.8.4:

Execution failed for task ':androidApp:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':androidApp:debugCompileClasspath'.
   > Could not find com.github.drjacky:ImagePicker:1.8.4.
     Required by:
         project :androidApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Crashes on some Android 10 devices

Hello,

I am using your library in a production application and have received some bug reports in my crashalytics dashboard.
It seems to affect certain devices running Android 10. I have tested locally with emulators and devices running Android 10 but could not reproduce the issue.

Firebase logs

Caused by android.graphics.ImageDecoder$DecodeException: Input was incomplete.
       at android.graphics.ImageDecoder.onPartialImage(ImageDecoder.java:1967)
       at android.graphics.ImageDecoder.nDecodeBitmap(ImageDecoder.java)
       at android.graphics.ImageDecoder.decodeBitmapInternal(ImageDecoder.java:1697)
       at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1854)
       at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1945)
       at com.github.drjacky.imagepicker.provider.CropProvider.getBitmap(CropProvider.kt:173)
       at com.github.drjacky.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:123)
       at com.github.drjacky.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:105)
       at com.github.drjacky.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:162)
       at com.github.drjacky.imagepicker.provider.CameraProvider.handleResult(CameraProvider.kt:156)
       at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:54)
       at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:25)
       at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:377)
       at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:336)
       at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:624)
       at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
       at android.app.Activity.dispatchActivityResult(Activity.java:8292)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5223)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5271)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7948)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

and

Caused by android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
       at android.graphics.ImageDecoder.nCreate(ImageDecoder.java)
       at android.graphics.ImageDecoder.createFromAssetFileDescriptor(ImageDecoder.java:351)
       at android.graphics.ImageDecoder.access$400(ImageDecoder.java:173)
       at android.graphics.ImageDecoder$ContentResolverSource.createImageDecoder(ImageDecoder.java:289)
       at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847)
       at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1945)
       at com.github.drjacky.imagepicker.provider.CropProvider.getBitmap(CropProvider.kt:173)
       at com.github.drjacky.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:123)
       at com.github.drjacky.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:105)
       at com.github.drjacky.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:162)
       at com.github.drjacky.imagepicker.provider.CameraProvider.handleResult(CameraProvider.kt:156)
       at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:54)
       at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:25)
       at androidx.activity.result.ActivityResultRegistry$1.onStateChanged(ActivityResultRegistry.java:148)
       at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
       at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)
       at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)
       at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
       at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
       at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
       at androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPostStarted(ReportFragment.java:187)
       at android.app.Activity.dispatchActivityPostStarted(Activity.java:1274)
       at android.app.Activity.performStart(Activity.java:8026)
       at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3677)
       at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
       at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Smartphone (please complete the following information):
All the logs are from devices running Android 10. Affected models seems to include:

  • Samsung Galaxy Note9
  • Samsung Galaxy A10

Code

Intent intent = ImagePicker.Companion.with(this)
          .cameraOnly()
          .crop()
          .createIntent();

The problem seems to arise in the crop functionality before the activity result callback function is called.
The problems have originated in apps which used version 2.1.7 of the library. I upgraded the library to the latest version (2.1.12) but I am not sure this will fix the issues. Any help regarding the issue would be much appreciated.

2.1.15 is not opening picker. 2.1.14 is working

Describe the bug
Hard to say because I did not see anything in logcat. App has target api 31 as well. Invocation is within jetpack compose. Please give me further instructions to assist

To Reproduce
Steps to reproduce the behaviour:

ImagePicker.with(context as Activity)
.maxResultSize(maxAvatarSize, maxAvatarSize)
.cropSquare()
.createIntentFromDialog { launcher.launch(it) }

Expected behavior

Image picker is opened

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Emulator
  • Xiaomi Redmi 10s
  • Galaxy S21

all of my phones

not work - both camera and gallery

hi,
I try to allow access to both the camera and the gallery.
When I run the app it crashes
Would appreciate help.

i used with this code:

   ImagePicker.Companion.with(this)
                       .crop()
                       .cropOval()
                       .maxResultSize(512, 512, true)
                       .createIntentFromDialog((Function1) (new Function1() {
                           public Object invoke(Object var1) {
                               this.invoke((Intent) var1);
                               return Unit.INSTANCE;
                           }

                           public final void invoke(@NotNull Intent it) {
                               Intrinsics.checkNotNullParameter(it, "it");
                               launcher.launch(it);
                           }
                       }));

when i used with this code- only gallery was open and camera crashes:

ImagePicker.Companion.with(HomePageActivity.this)
                        .crop()
                        //.cropOval()
                        //.compress(1024)
                        .maxResultSize(1080,1080)
                        .galleryMimeTypes(mimeTypes)
                        .start();

Java language

Toast storage permission

Your lib is working fine on all of my emulator API 24 to 30 on dev flavor.
But in production (PlayStore, device API 29) I get a toast with "Storage permission is needed to take a picture. Please allow storage permission from Settings -> Permissions.".
Am I missing something obvious ?
I copy your sample/manifest permissions :/
thx

Getting Unable to decode stream: java.io.FileNotFoundException if crop is false

Hi! Thanks for the library!

Checked sample app.
Getting BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /document/image:197117: open failed: ENOENT (No such file or directory) if don't add crop()

ImagePicker.with(this)
//                .crop()
//                .cropOval()
                .maxResultSize(512, 512, true)
                .createIntentFromDialog { profileLauncher.launch(it) }

Jitpack requires different implementation syntax

Thanks for your great library!

While trying to use it, I got an error:

Could not determine the dependencies of task ':app:compileGplayDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:gplayDebugCompileClasspath'.
   > Could not find :unspecified:.
     Required by:
         project :app > com.github.Drjacky:ImagePicker:1.8.1

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

This was with: implementation 'com.github.Drjacky:ImagePicker:1.8.1'

Changing it to implementation 'com.github.drJacky:ImagePicker:1.8.1' as found on https://jitpack.io/#drJacky/ImagePicker/1.8.1 worked.

This repo does not work Properly

FAILURE: Build completed with 8 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

2: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugResources'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

3: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugMainManifest'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

4: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugAssets'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

5: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugJavaResource'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

6: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugDuplicateClasses'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

7: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:desugarDebugFileDependencies'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

8: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugNativeLibs'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
20 actionable tasks: 19 executed, 1 up-to-date

when I start to build then it shows building fail and error .
please refer to this image.

Screenshot (40)
Screenshot (41)

Library with latest version2.1.11 is not working with OS 11

After allowing storage permission , app crashes and in logs it comes access permission issue, though i already allowed permission.
it should redirect to settings to manage storage permission as per solutions suggested in developer.com and on stack overflow.
Please let me know how this can be fixed , if anything has to be added in manifest of anything

ucrop not found error

Describe the bug
When I run app, this error found on log and stopped running further.

8: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugNativeLibs'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:2.1.13

To Reproduce

  1. Add Dependencies on build.gradle
  2. Click on Run
  3. See error on Log

Expected behavior
Run with no issues.

Screenshots
Used in MainActivity on onCreate method.

fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ImagePicker.with(MainActivity.this)
                        .createIntent();
            }
        });

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

This is my build.gradle App

plugins {
    id 'com.android.application'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.example.example"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'com.airbnb.android:lottie:4.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation 'com.github.Drjacky:ImagePicker:2.1.13'
}

This is my build.gradle Project

buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.1"
    }
}


task clean(type: Delete) {
    delete rootProject.buildDir
}

Define Picture Output Format (e.g. WebP)

Is your feature request related to a problem? Please describe.
Currently you cannot define output format and the origin format is used. If you pick a jpg file and crop it you have to convert to webp on your own

Describe the solution you'd like
On the library level it would be easy to convert e.g.

FileOutputStream out = new FileOutputStream(path);
bitmap.compress(Bitmap.CompressFormat.WEBP, 100, out);
out.close();

requestLegacyExternalStorage

Hi there

I wanted to point out that the requestLegacyExternaStorage flag in the Manifest will be ignored when targhetting Android 11.

https://developer.android.com/about/versions/11/privacy/storage

Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. >This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different >directories and different types of media files. After you update your app to target Android 11, the system ignores the >requestLegacyExternalStorage flag.

Canvas: trying to draw too large(256576512bytes) bitmap.

Describe the bug
Canvas: trying to draw too large(256576512bytes) bitmap.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Take photo from camera'
  2. set image mode as 64MP (or above if support)
  3. Skip crop if enabled and Press "Done"
  4. App will crash and See error in Logcat

Smartphone (please complete the following information):

  • Device: Samsung A71
  • OS: Android
  • Version 11

Logcat stack trace
java.lang.RuntimeException: Canvas: trying to draw too large(256576512bytes) bitmap.
at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:281)
at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:91)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:548)
at com.squareup.picasso.PicassoDrawable.draw(PicassoDrawable.java:109)
at android.widget.ImageView.onDraw(ImageView.java:1453)
at android.view.View.draw(View.java:23901)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.recyclerview.widget.RecyclerView.drawChild(RecyclerView.java:5030)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at androidx.recyclerview.widget.RecyclerView.draw(RecyclerView.java:4429)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.widget.ScrollView.draw(ScrollView.java:2876)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.fragment.app.FragmentContainerView.drawChild(FragmentContainerView.java:268)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.fragment.app.FragmentContainerView.dispatchDraw(FragmentContainerView.java:256)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
2021-10-20 15:54:36.684 28776-28776/? E/AndroidRuntime: at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1478)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at com.android.internal.policy.DecorView.draw(DecorView.java:1282)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:579)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:585)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:662)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4994)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4701)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3818)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2575)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9910)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
at android.view.Choreographer.doCallbacks(Choreographer.java:809)
at android.view.Choreographer.doFrame(Choreographer.java:744)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8506)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Localization

Hi
How can I localize words on the choose dialog?
Schermata 2021-04-12 alle 15 58 49

Thanks

Could not resolve all files for configuration ( Could not find com.github.yalantis:ucrop:2.2.6)

Getting this while building the app (android version Lollipop)

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find :unspecified:.
     Required by:
         project :app > com.github.Drjacky:ImagePicker:1.8.1
   > Could not find com.github.yalantis:ucrop:2.2.6.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
     Required by:
         project :app > com.github.Drjacky:ImagePicker:1.8.1

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Not working well

I have added the required repositories and dependency but still not working

[Help Wanted] How to write this code in java? I want to call this inside a fragment.

ImagePicker.with(this)
        .compress(1024)         //Final image size will be less than 1 MB(Optional)
        .maxResultSize(1080, 1080)  //Final image resolution will be less than 1080 x 1080(Optional)
        .start { resultCode, data ->
            if (resultCode == Activity.RESULT_OK) {
                //Image Uri will not be null for RESULT_OK
                 val fileUri = data?.data
                 imgProfile.setImageURI(fileUri)
              
                //You can get File object from intent
                val file:File = ImagePicker.getFile(data)
               
                //You can also get File Path from intent
                val filePath:String = ImagePicker.getFilePath(data)
            } else if (resultCode == ImagePicker.RESULT_ERROR) {
                Toast.makeText(context, ImagePicker.getError(data), Toast.LENGTH_SHORT).show()
            } else {
                Toast.makeText(context, "Task Cancelled", Toast.LENGTH_SHORT).show()
            }
        }

Customize saving behavior for selected and cropped image

Is your feature request related to a problem? Please describe.
I don't want to keep the selected image in the storage, only cropped one. And now, my only option is to manually delete it.

Describe the solution you'd like
Builder option, something like .saveOnlyCroppedImg().

Describe alternatives you've considered
Return both image URIs for the activity result.

Additional context
I think it definitely belongs here, because this library stores both images and appends suffixes to them by default. And it would be nice to have the ability to customize this behavior. 🙂

Gallery text on Dialog option 'y' text seem cropped

Describe the bug
Call createIntentFromDialog option , Camera and gallery option displayed. where Y of gallery text shows cropped from bottom.

Expected behavior
Both Camera and Gallery text should be clear visible without cropped text

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: RealMe XT
  • XXHDPI

Screenshot_2021-09-06-16-16-21-01_d51d67da3b25686056ad1503b0054826

unable to pass result code

Describe the bug
I had updated library to latest version 2.1.13
but unable to pass start() as per documentation for request code
nostart

Configure to use only front camera

Is your feature request related to a problem? Please describe.
When starting with cameraOnly() I would like to be able to set ImagePicker to either A) only allow the front camera or B) start with the front camera and allow the user to switch to the rear camera.

Describe the solution you'd like
For either of the cases above, a config option similar to cameraOnly like frontCameraOnly or startFrontCamera that either restricts user to front camera, or starts them off with it.

Describe alternatives you've considered
I tried overriding the provider methods in library, but haven't had much luck with it.

Additional context
Basically I'm using this library to capture or pick profile photos. Those are typically taken as selfies and not from the rear camera.

class file for kotlin.jvm.functions.Function2 not found

Code Usage

ImagePicker.Companion.with(this)
                .compress(1024)
                .maxResultSize(1080, 1080)
                .start(PROFILE_IMAGE_REQ_CODE);
implementation 'com.github.Drjacky:ImagePicker:1.7.10'
implementation 'com.github.florent37:inline-activity-result-kotlin:1.0.4'

Build Error

error: cannot access Function2
                .start(PROFILE_IMAGE_REQ_CODE);//PROFILE_IMAGE_REQ_CODE
                ^
  class file for kotlin.jvm.functions.Function2 not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.