Closed yatinjulka95 closed 3 years ago
This isn't my library but I've raised a few pull requests on it recently so have become familiar with it. Hopefully I can help. Please can you provide the following information:
Hi I had the same issue. I used the below method to return the correct file path from the URI and load in to the intent
public String getImageFilePath(Uri uri) {
File file = new File(uri.getPath());
String[] filePath = file.getPath().split(":");
String image_id = filePath[filePath.length - 1];
Cursor cursor = getContentResolver().query(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, MediaStore.Images.Media._ID + " = ? ", new String[]{image_id}, null);
if (cursor != null) {
cursor.moveToFirst();
String imagePath = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
cursor.close();
return imagePath;
}
return null;
}
I hope this helps as it drove me up the wall
@yatinjulka95 @joemerritt I'd appreciate if you could share a log for the error so that we can resolve this from the root.
This was fixed in this commit https://github.com/iamutkarshtiwari/Ananas/pull/94 Please feel free to re-open this ticket if the issue persists.
First of all, Your library is very helpful to me. But now when i pass filePath to EditImageActivity i always this error "Failed to load the image!"
You have used this Toast in this method given below.
Have you updated the code ? Can you help me in this ?
private void loadImageFromFile(String filePath) { compositeDisposable.clear();
Disposable loadImageDisposable = loadImage(filePath) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnSubscribe(subscriber -> loadingDialog.show()) .doFinally(() -> loadingDialog.dismiss()) .subscribe(processedBitmap -> changeMainBitmap(processedBitmap, false), e -> showToast(R.string.iamutkarshtiwari_github_io_ananas_load_error));
compositeDisposable.add(loadImageDisposable); }
--
Thanks & Regards, Yatin Julka Android Developer