Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide load local image by Uri.

I'm trying to use Glide to load an image from local storage with no success.

Glide.with(mContext)     .load(pictureUri) // Uri of the picture     .transform(new CircleTransform(..))     .into(profileAvatar); 

This is the error I get:

java.lang.Exception: Failed to load model: '/storage/emulated/0/DCIM/Camera/IMG_20150831_180900.jpg' at com.bumptech.glide.request.GenericRequest.onSizeReady(GenericRequest.java:441) at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.getSize(ViewTarget.java:211) at com.bumptech.glide.request.target.ViewTarget.getSize(ViewTarget.java:100) at com.bumptech.glide.request.GenericRequest.begin(GenericRequest.java:272) at com.bumptech.glide.manager.RequestTracker.resumeRequests(RequestTracker.java:83) at com.bumptech.glide.RequestManager.resumeRequests(RequestManager.java:180) at com.bumptech.glide.RequestManager.onStart(RequestManager.java:203) at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:50) at com.bumptech.glide.manager.SupportRequestManagerFragment.onStart(SupportRequestManagerFragment.java:135) at android.support.v4.app.Fragment.performStart(Fragment.java:1986) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1051) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1197) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1179) at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:1996) at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:176) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:517) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236) at android.app.Activity.performStart(Activity.java:6006) at android.app.Activity.performRestart(Activity.java:6063) at android.app.Activity.performResume(Activity.java:6068) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
like image 897
Tudor Luca Avatar asked Sep 01 '15 12:09

Tudor Luca


People also ask

What is Bumptech Glide?

Glide is an Image Loader Library for Android developed by bumptech and is a library that is recommended by Google. It has been used in many Google open source projects including Google I/O 2014 official application. It provides animated GIF support and handles image loading/caching.


Video Answer


1 Answers

While waiting for someone to respond, I tried to make a File instance from the Uri and load that. It works! Weird!

Glide.with(mContext)     .load(new File(pictureUri.getPath())) // Uri of the picture     .transform(new CircleTransform(..))     .into(profileAvatar); 
like image 71
Tudor Luca Avatar answered Sep 21 '22 06:09

Tudor Luca