fresco
fresco copied to clipboard
How can i known the image path cached on disk?
as the question title,when user see the image,he wont to save the image or share with anyone,how can i do with fresco?
I have made this using pipeline I get the image save it to sd card then share it, it would be better if we can get the URI directly without saving it again. This is the code :
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).build();
DataSource<CloseableReference<CloseableImage>> dataSource =
mImagePipeline.fetchDecodedImage(imageRequest, this);
try {
Bitmap bitmap;
CloseableReference<CloseableImage> imageReference = dataSource.getResult();
if (imageReference != null) {
try {
bitmap = ((CloseableBitmap) imageReference.get()).getUnderlyingBitmap();
file = FilesUtils.saveShareBitmap(bitmap, Consts.APP_ALBUM, "image" + currentItem + ".jpg");
Uri imageUri = Uri.fromFile(file);
} finally {
CloseableReference.closeSafely(imageReference);
}
}
} finally {
dataSource.close();
}
You can simply use the image pipeline to retrieve the encoded image out of cache. Then just save it to a file.