jkwiecien / easyimage Goto Github PK
View Code? Open in Web Editor NEWLibrary for picking pictures from gallery or camera
Library for picking pictures from gallery or camera
System.err: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/pl.aprilapps.easyphotopicker.sample/cache/EasyImage/7f92ccdc-1d35-41f8-89e4-84b252ed1a5b-1112704913.jpg
09-20 13:46:13.656 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:679)
09-20 13:46:13.656 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:378)
09-20 13:46:13.656 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.EasyImage.createCameraPictureFile(EasyImage.java:54)
09-20 13:46:13.656 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.EasyImage.createCameraIntent(EasyImage.java:79)
09-20 13:46:13.656 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.EasyImage.openCamera(EasyImage.java:229)
09-20 13:46:13.657 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.sample.MainActivity.onTakePhotoClicked(MainActivity.java:68)
09-20 13:46:13.657 2424-2424/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.sample.MainActivity$$ViewBinder$1.doClick
When trying to open camera
EasyImage.openCamera(this);
This happens
W/System.err: java.io.IOException: open failed: ENOENT (No such file or directory)
W/System.err: at java.io.File.createNewFile(File.java:939)
W/System.err: at java.io.File.createTempFile(File.java:1004)
W/System.err: at pl.aprilapps.easyphotopicker.EasyImage.openCamera(EasyImage.java:59)
The method saveInRootPicturesDirectory is raising a NullPointerException : Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
public EasyImage.Configuration saveInRootPicturesDirectory() {
PreferenceManager.getDefaultSharedPreferences(this.context).edit().putString("pl.aprilapps.folder_location", EasyImageFiles.publicRootDir(this.context).toString()).commit();
return this;
}
Specifically, EasyImageFiles.publicRootDir(this.context) seems to return null.
Cheers
Example :
EasyImage.configuration(this)
.saveInAppExternalFilesDir()
.setImagesFolderName(FOLDER);
will lead to a different configuration than
EasyImage.configuration(this)
.setImagesFolderName(FOLDER)
.saveInAppExternalFilesDir();
This is because saveInAppExternalFilesDir()
and saveInRootPicturesDirectory()
are both relying on the folder name, which in the first case is not set by the time saveInAppExternalFilesDir()
is called.
Hi there,
Thanks for the library - useful stuff! :)
I have one suggestion for an improvement. When picking a picture from gallery for example, your code seems to copy the picture from it's original location, to the app's cache folder. This is great, except for one thing. I'm trying to later open an image viewer to view that picture (ACTION_VIEW intent), however, it's failing since outside apps don't have access to the cache folder in Android. (file:///data/user/0//cache//4d89c464-4b04-4c5e-ad6a-b3233790a36c).
I don't have this problem for images taken with the camera, since your code stores them in the app folder but on the sdcard (file:///storage/x/Android/data//files/Pictures//1b89f9d0-5c12-452b-aa13-5f3937ef5a20-906294538.jpg)
Any chance we can have an option to store the images picked into the publicly accessible app folder instead of the internal cache? Basically it would involve changing the folder returned here (https://github.com/jkwiecien/EasyImage/blob/master/library/src/main/java/pl/aprilapps/easyphotopicker/EasyImage.java#L51) based on a config.
Thanks!
I use this library since five months ago and I am trying to call openChooserWithGallery function and I get this error since a few days ago:
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/com.company.app/cache/EasyImage/888dc77f-732f-4f1d-826b-505a67443945-2141116506.jpg at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:678) at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:377) at pl.aprilapps.easyphotopicker.EasyImage.createCameraPictureFile(EasyImage.java:54) at pl.aprilapps.easyphotopicker.EasyImage.createChooserIntent(EasyImage.java:109) at pl.aprilapps.easyphotopicker.EasyImage.openChooserWithGallery(EasyImage.java:173)
EDIT
Solved updating Google Play Services Version from 9.0.0 to 9.4.0
java.io.IOException: open failed: ENOENT (No such file or directory)
at java.io.File.createNewFile(File.java:940)
at java.io.File.createTempFile(File.java:1005)
at pl.aprilapps.easyphotopicker.EasyImage.createCameraPictureFile(EasyImage.java:80)
at pl.aprilapps.easyphotopicker.EasyImage.createCameraIntent(EasyImage.java:92)
at pl.aprilapps.easyphotopicker.EasyImage.openCamera(EasyImage.java:187)
[...]
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at java.io.File.createNewFile(File.java:933)
AND
java.io.FileNotFoundException: {file path - used saveInAppExternalFilesDir() configuration with custom folder name}: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.(FileOutputStream.java:88)
at java.io.FileOutputStream.(FileOutputStream.java:128)
at java.io.FileOutputStream.(FileOutputStream.java:117)
at pl.aprilapps.easyphotopicker.EasyImage.onPictureReturnedFromGallery(EasyImage.java:298)
Both occurred on HTC Desire X, Android 4.1.1
Hello,
Some runtime exception being raised by the root call openChooseWithGallery()
Caused by java.lang.NullPointerException
at pl.aprilapps.easyphotopicker.EasyImageFiles.getFolderLocation(EasyImageFiles.java:100)
at pl.aprilapps.easyphotopicker.EasyImageFiles.getCameraPicturesLocation(EasyImageFiles.java:105)
at pl.aprilapps.easyphotopicker.EasyImage.createCameraPictureFile(EasyImage.java:49)
at pl.aprilapps.easyphotopicker.EasyImage.createChooserIntent(EasyImage.java:91)
at pl.aprilapps.easyphotopicker.EasyImage.openChooserWithGallery(EasyImage.java:155)
Cheers
Hi! Thank you for your library! :)
When using EasyImage.openCamera(), the intent resturned is null!
But when using EasyImage.openGalleryPicker(), it is OK!
I've tested on OnePlus One (5.1.1) and Nexus 7 (6.0) with Runtime Permission implemented.
Do you have a similar problem?
Thanks!
Denis
Some mobile phones has these problems
eg : on RedMI NODE 3
java.io.FileNotFoundException: Multiple items at content://media/external/images/media
Hi there,
I might be implementing the library incorrectly, but is it possible to get a content uri in the style of:
content://com.android.providers.media.documents/document/image%3A64
from the handleActivityResults#onImagePicked
method?
If not, could you implement this feature please?
is there any way to select multiple images if we use
EasyImage.openGalleryPicker(this);
Hi,
I got this error when loading image from gallery :
java.io.IOException: open failed: ENOENT (No such file or directory)
my device nexus 5.
OS M
Calling EasyImage.openChooser
when the external storage is not mounted throws this exception:
java.lang.NullPointerException
at pl.aprilapps.easyphotopicker.EasyImageFiles.getFolderLocation(EasyImageFiles.java:98)
at pl.aprilapps.easyphotopicker.EasyImageFiles.getCameraPicturesLocation(EasyImageFiles.java:103)
at pl.aprilapps.easyphotopicker.EasyImage.createCameraPictureFile(EasyImage.java:59)
at pl.aprilapps.easyphotopicker.EasyImage.createChooserIntent(EasyImage.java:85)
at pl.aprilapps.easyphotopicker.EasyImage.openChooser(EasyImage.java:150)
[omitted]
I'm not sure how the library should handle this situation though. IHMO the possibilities are:
FileProvider
and let the camera save the image in the app internal folder.Can't return camera image in Moto G
The path is in wrong location...
onActivityResult not called in Fragment.
Some phones onPictureReturnedFromCamera onImagePicked()
the imageFile.length()==0;
I don't know if this suggestion will be possible or easy to implement,
but it will be great if we have an extra option on the picker to remove the current image selected!?
I love this library, it looks and feels great.
I'd love to use the system picker for all files, not just images.
Is this possible?
Profileimages are normally round - therefore it would be great to show the user while taking a picture a round overlay.
Hello, found out of memory crash,tested with Galaxy S2 and S5:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 20457196 byte allocation with 4194208 free bytes and 13MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:812)
at android.graphics.Bitmap.createBitmap(Bitmap.java:789)
at android.graphics.Bitmap.createBitmap(Bitmap.java:720)
at com.theartofdev.edmodo.cropper.BitmapUtils.rotateBitmapInt(BitmapUtils.java:499)
at com.theartofdev.edmodo.cropper.BitmapUtils.cropBitmap(BitmapUtils.java:197)
at com.theartofdev.edmodo.cropper.BitmapCroppingWorkerTask.doInBackground(BitmapCroppingWorkerTask.java:176)
at com.theartofdev.edmodo.cropper.BitmapCroppingWorkerTask.doInBackground(BitmapCroppingWorkerTask.java:25)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
When picking from camera.
Another request if we can have one more option to be set to show only the gallery and the camera without showing the other images apps.
For instance: if you have apps like camera360 or any other app, they will be shown in the picker.
Thanks a lot.
Hey ,
i found this bug android.os.FileUriExposedException when opening the camera
the bug as reffered here
https://developer.android.com/reference/android/os/FileUriExposedException.html
is from N and later
quick suggested fix is to change from file:// to content://
How can I get the right path of the picture ?
Actually the path like this :
/data/user/0/my.project.package/cache/1a00887e-c87e-498b-9f61-66dfb27ce66b.jpg
But I want a path like :
/storage/emulated/0/DCIM/Camera/myfile.jpg
Hello,
this library is really good and saves a lot of time but i found an issue with image orientation on Samsung phones. All pictures taken in portrait are saved rotated 90 degrees. When i take picture in landscape mode everything is fine. This is an issue that i found only on Samsung phones so far.
I'm using Samsung S3.
Demo project is missing Manifest.permission.CAMERA permission request. It'll be nice to have callbacks on Camera and Gallery selection, after calling openChooserWithGallery. In this case we will be able to check permissions separately: WRITE_EXTERNAL_STORAGE && CAMERA for camera and WRITE_EXTERNAL_STORAGE for gallery. Thanks.
Thanks for the library!
I configure EasyImage like this:
EasyImage.configuration(getContext()).setCopyExistingPicturesToPublicLocation(true).setImagesFolderName("images").saveInAppExternalFilesDir();
Is there a way to to remove the cached files once i am done with them?
I call EasyImage.clearPublicTemp(getContext()); and it clears the TEMP folder but there are still images with 0 size in the "images" folder specified in the config. What are those used for?
See notes on ACTION_IMAGE_CAPTURE and the issue#188073
I test it can be replace with ACTION_IMAGE_CAPTURE_SECURE
intent
Log:
Failed to ensure directory: /storage/sdcard1/Android/data/com.testapp.test/files/Pictures
I have proper permissions declared in manifest.
I am running on : Android 4.4.4
This is happening only with device (as of now):
Xiaomi Redmi 2 Prime
http://www.gsmarena.com/xiaomi_redmi_2_prime-7480.php
with your sample, i have error :
11-07 22:15:07.773 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE_SECURE (has extras) } 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1638) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1430) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3470) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3426) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.EasyImage.openCamera(EasyImage.java:71) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.sample.MainActivity.onTakePhotoClicked(MainActivity.java:43) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at pl.aprilapps.easyphotopicker.sample.MainActivity$$ViewBinder$1.doClick(MainActivity$$ViewBinder.java:19) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.view.View.performClick(View.java:4561) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.view.View$PerformClick.run(View.java:18941) 11-07 22:15:07.774 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.os.Handler.handleCallback(Handler.java:808) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.os.Handler.dispatchMessage(Handler.java:103) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.os.Looper.loop(Looper.java:193) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5395) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at java.lang.reflect.Method.invoke(Method.java:515) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653) 11-07 22:15:07.775 28618-28618/pl.aprilapps.easyphotopicker.sample W/System.err: at dalvik.system.NativeStart.main(Native Method)
on lenovo, android API 19.
please fix it
I try to select the images that i have selected previously or select image from EasyImage folder. sometimes the File extension is not coming.
@Override
public void onImagePicked(File imageFile, EasyImage.ImageSource source) {
//Handle the image
uploadToServer(imageFile);
}
Thank you so much for making this awesome library
But, I am getting following error on some phone
**Devices
samsung 44%
motorola 12%
HUAWEI 7%
Other… 37%
Operating Systems
4 -------------38%
5 -------------37%
6 -------------25%**
I am getting crashes 80 times in 30 days....
Fatal Exception: android.content.ActivityNotFoundException
No Activity found to handle Intent { act=android.intent.action.PICK dat=content://media/external/images/media }
Raw Text
android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1792)
android.app.Instrumentation.execStartActivity (Instrumentation.java:1512)
android.app.Activity.startActivityForResult (Activity.java:3833)
android.app.Activity.startActivityForResult (Activity.java:3784)
pl.aprilapps.easyphotopicker.EasyImage.openGallery (EasyImage.java:215)
com.xyz.image.ChooserActivity.onGalleryClick (ChooserActivity.java:279)
com.xyz.image.ChooserActivity.onClick (ChooserActivity.java:337)
Will be awesome to add a feature of multiple image selection, Please :D
Need to add support of different request codes. Sample case is if you have more than one ImageView and Button to take picture and show it in ImageView. Need to load specific image to specific ImageView.
It would be great if you could rename the folder "Images".
Thank you very much for creating this library, it helps to avoid having to do the same process again and again each time you want to manage images from the gallery or from the camera.
Both camera and gallery picker does not work on marshmallow.
Gallery returns blank list of image, while camera nothing happens.
Is there any plan to update to support marshmallow?
Since you set the requestCode fixed inside the openChooser... methods, I found no way how to differentiate between, say, 2 different image pick calls from the same activity.
In my case I want to pick either image 1 to populate ImageView A, or image 2 to populate ImageView 2.
Normally I would do this with different request codes, and handle the result appropriately.
Is there any way around it in the current configuration?
I know I can work around it with keeping track of the clicked button, but I was looking for a more stateless way.
Maybe you could introduce a request code parameter, which would then be binary combined with the internal request code, and on receiving the result, it would be resolved back and being passed into the callback?
Hi there,
My name is Farid. I'm a developer with great interest in making open source contributions to popular projects.
My company - DevFactory - is sponsoring me to improve unit test coverage in open source projects.
I have analyzed EasyImage and observed that there is room for improvement of coverage. The results indicate that the project does not have any unit tests.
If you are interested in having us work towards improving the project’s coverage to 80%, please let me know and we will add it to our pipeline. Our first step will be to create a pull request with a sample. Once you approve it, we'll follow up with one or two more pull requests. Our target is to increase code coverage to above 80 percent.
For an example of our work, please see these Pull Requests accepted by the community:
I'm looking forward to your confirmation.
Thank you,
Mohd Farid
Open Source Code Coverage Team
DevFactory
Hi all,
My problem is using EasyImage in fragment and most problem with sample code in fragment
I dont know how figure out EasyImage.handleActivityResult(requestCode, resultCode, data, this, new DefaultCallback() because 3th parameters need activity .
if someone solved this problem please tell me
EasyImage.openChooserWithGallery(this, "Image...", 0);
---> E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 17532784)
But it seems that all is working fine.
I got this issue related to rx.internal.util.unsafe.UnsafeAccess.addressOf (Unknown Source)
Although I have added proguard configurations from discussion 1 and discussion 2. I still get the same error from the above..
-dontwarn rx.**
#-dontwarn rx.internal.*
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}
-keep class rx.internal.util.unsafe { *;}
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
public <methods>;
}
-keep class rx.schedulers.TestScheduler {
public <methods>;
}
-keep class rx.schedulers.Schedulers {
public static ** test();
}
Hey, I really love this library!
One thing that is kind of bothering me is that the name of the image file that is being returned has no extension but only the UUID string like "2668b62b-ba73-4c3d-96e3-0e4174f43175". Would it be possible to retain the original extension like .jpg or .png?
Great Lib, TnQ for this amazing work.
is this lib supports crop feature when using camera?
if not can u add this?
TnQ
Hi, great lib!
I'm using your library to take a photograph from the camera. But its size is 780x1040 instead of 3120x4160.
I was just wondering if you resize them?
Thanks :)
Denis
java.lang.NoSuchMethodError: No static method openCamera(Landroid/app/Activity;I)V in class Lpl/aprilapps/easyphotopicker/EasyImage; or its super classes (declaration of 'pl.aprilapps.easyphotopicker.EasyImage' appears in /data/app/com.example-2/base.apk:classes15.dex)
I tried doing Invalidate/Restart no luck.
Caused by java.lang.NullPointerException
at pl.aprilapps.easyphotopicker.EasyImage$Configuration.saveInAppExternalFilesDir(EasyImage.java:376)
at app.flirtbox.dating.ui.start.AuthenticatorActivity.onCreate(AuthenticatorActivity.java:102)
at android.app.Activity.performCreate(Activity.java:5258)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.