EasyImage
EasyImage copied to clipboard
Don't cache image
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
I should think so
?
Why would you need that path? It's the matter of the access
@jkwiecien why it's not save to DCIM directory? What sould i do for save to DCIM?
Do any solution exists for this issue?
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)