EasyImage icon indicating copy to clipboard operation
EasyImage copied to clipboard

Don't cache image

Open gogui63 opened this issue 8 years ago • 6 comments

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

gogui63 avatar Jun 26 '16 20:06 gogui63

I should think so

longtaoge avatar Jul 08 '16 01:07 longtaoge

?

bkawakami avatar Jul 27 '16 20:07 bkawakami

Why would you need that path? It's the matter of the access

jkwiecien avatar Dec 22 '16 15:12 jkwiecien

@jkwiecien why it's not save to DCIM directory? What sould i do for save to DCIM?

ismaiI1 avatar Jul 07 '17 12:07 ismaiI1

Do any solution exists for this issue?

monowar1993 avatar Dec 21 '17 14:12 monowar1993

Here is a workaround for that problem :-)

public void onImagesPicked(List<File> imageFiles, EasyImage.ImageSource source, int type) {
         File ImageFile = imageFiles.get(0);
         ContextWrapper cw = new ContextWrapper(getContext());
                File directory = cw.getDir("images", Context.MODE_PRIVATE);
                if (!directory.exists()) {
                    directory.mkdir();
                }
                File mypath = new File(directory, ImageFile.getName());

                FileOutputStream fos = null;
                try {
                    fos = new FileOutputStream(mypath);
                    Bitmap bitmap = BitmapFactory.decodeFile(ImageFile.getAbsolutePath());
                    ImageFile = mypath;
                    mPlace.setImage_path(ImageFile.getAbsolutePath());
                    bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
                    fos.close();
                } catch (Exception e) {
                    Log.e("SAVE_IMAGE", e.getMessage(), e);
                }
       }

Be sure to set these configurations if you don't want to save the file in the cache folder.

EasyImage.configuration(getContext()) .setImagesFolderName(null) .setCopyTakenPhotosToPublicGalleryAppFolder(false) .setCopyPickedImagesToPublicGalleryAppFolder(false)

ArshilAzim avatar Aug 05 '19 20:08 ArshilAzim