Picasso: Could not load image from a redirected url

Created on 3 Apr 2014  路  19Comments  路  Source: square/picasso

Picasso can not load image from URL:

http://graph.facebook.com/1610564116/picture?width=250&height=250

What is the problem?

Thank you for your help

Most helpful comment

Still having this issue in 2.5.2:
http://placehold.it/150/7735a
->
https://placeholdit.imgix.net/~text?txtsize=14&bg=7735a&txt=150%C3%97150&w=150&h=150

Not displaying a thing

All 19 comments

It is redirecting from HTTP to HTTPS and your client probably isn't
handling that properly. Either request that URL with HTTPS so the redirect
stays on the same protocol or drop OkHttp into your app (it will follow the
cross-protocol redirect).
On Apr 3, 2014 4:54 AM, "jfk4080" [email protected] wrote:

Picasso can not load image from URL:

http://graph.facebook.com/1610564116/picture?width=250&height=250

What is the problem?

Thank you for your help

Reply to this email directly or view it on GitHubhttps://github.com/square/picasso/issues/463
.

I had the same problem, but I got it to work according to Jake's answer.
Previously I was replacing "https" with "http" following this stackoverflow
answer
http://stackoverflow.com/questions/22674680/picasso-library-stopped-working-today-with-facebook-graph-picture-links
But that failed, and I found that if I stuck with "https" then it would
work again.

On Thu, Apr 3, 2014 at 9:43 AM, Jake Wharton [email protected]:

It is redirecting from HTTP to HTTPS and your client probably isn't
handling that properly. Either request that URL with HTTPS so the redirect
stays on the same protocol or drop OkHttp into your app (it will follow the
cross-protocol redirect).

On Apr 3, 2014 4:54 AM, "jfk4080" [email protected] wrote:

Picasso can not load image from URL:

http://graph.facebook.com/1610564116/picture?width=250&height=250

What is the problem?

Thank you for your help

Reply to this email directly or view it on GitHub<
https://github.com/square/picasso/issues/463>

.

Reply to this email directly or view it on GitHubhttps://github.com/square/picasso/issues/463#issuecomment-39474692
.

Yes, that was it. It works now perfectly.

Thank you very much.

So what's the resolution for this exactly? When my URL shortener redirects an http url to https it doesn't load.

For example:
http://goo.gl/FvWi1r

becomes
https://s3.amazonaws.com/gs-geo-images/1589f18c-67c7-4f8c-815d-7067ad2136d9.jpg

and the image will not load.

I _should_ have control over the image urls to avoid this, but I'm still wondering what's the appropriate way to handle this in case it becomes unavoidable.

Still having this issue in 2.5.2:
http://placehold.it/150/7735a
->
https://placeholdit.imgix.net/~text?txtsize=14&bg=7735a&txt=150%C3%97150&w=150&h=150

Not displaying a thing

Please reopen as this is still an issue.

Hello. Finally someone solve it?

I have the same problem but I solved doing changing the picasso downloader to OkHttpDownloader, so as OkHttp now is on version 3 you will need to add this to gradle
compile 'com.squareup.okhttp:okhttp:2.5.0'

Picasso.Builder builder = new Picasso.Builder(context);
builder.listener(new Picasso.Listener() {
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
holder.getIvSpeakerPicture()
.setImageDrawable(context.getResources()
.getDrawable("your drawable id"));
}
});
builder.downloader(new OkHttpDownloader(context));
builder.build().load("your url").into(holder.getIvSpeakerPicture());

Hi, @oscarg798 what is "holder" in above code. I couldn't find a reference for that.

@maduperera it looks like a view holder, I'm guessing getIvSpeakerPicture() returns an image view.

Oh no!
it really is. How did I miss getIvSpeakerPicture(). hehe.
Thanks @hk0i. And Thanks @oscarg798, it worked as you said.

@maduperera yeap holder is the viewholder as @hk0i said :D

@oscarg798 Thanks a lot man..Spent forever trying to get this.

I was with the same problem replacing Picasso by Fresco

I had the same problem using this code.

Picasso.with(context)

I fixed it by this code.

val downloader = OkHttp3Downloader(context)
Picasso.Builder(context).downloader(downloader).build()

OkHttpClient has a followRedirects property and a followSslRedirects property.
Both are set to true by default.

thanks

I added this one and tried the way jumperson posted and worked well
https://github.com/JakeWharton/picasso2-okhttp3-downloader

@jumperson
thanks a lot!

Hey guys I have made CustomPicasso gist from @jumperson and @shtsht comments using @JakeWharton's picasso2-okhttp3-downloader

CustomPicasso gist - https://gist.github.com/hrishikesh-kadam/09cef31c736de088313f1a102f5ed3a3

compile 'com.squareup.okhttp:okhttp:2.5.0'

Picasso.Builder builder = new Picasso.Builder(mContext);
builder.downloader(new OkHttpDownloader(mContext));
builder.build().load(image).into(viewHolder.image);
Was this page helpful?
0 / 5 - 0 ratings