Thumbnails Broken for Certain Images

18 views
Skip to first unread message

josh...@gmail.com

unread,
Feb 4, 2015, 5:34:19 PM2/4/15
to im...@googlegroups.com
Hello,

I was following the guide here https://api.imgur.com/models/image#thumbs to generate thumbnails for images that I retrieve from the gallery. I noticed that about 99% of the time it works perfectly. But every once in awhile my app shows no thumbnail. Here is an example of a working image. The link being http://i.imgur.com/L1mXDr0.jpg, so if I add in a `b` to get the small block thumbnail the link would be http://i.imgur.com/L1mXDr0b.jpg. That is a working thumbnail.

But let's take this image for example http://i.imgur.com/S2UYSU1h.gif. Following the same pattern giving me this URL http://i.imgur.com/S2UYSU1hb.gif results in the standard Zoinks! error page (I love that page by the way). Do thumbnails not work with gifs? Or is this a bug? And if thumbnails don't work with gifs, is there an alternative method to accomplish what I'm attempting to do?

Thanks!
Josh Ault

@jasdev

unread,
Feb 4, 2015, 5:44:57 PM2/4/15
to im...@googlegroups.com
You just need to remove the trailing `h` and replace with a `b`!

Can't concatenate thumbnails on top of one another :)


Hope this helps!

Jasdev

josh...@gmail.com

unread,
Feb 4, 2015, 5:54:05 PM2/4/15
to im...@googlegroups.com
That makes a lot of sense! I should've noticed that before. But that brings up another questions. So that link I received (http://i.imgur.com/S2UYSU1h.gif) was directly from retrieving the most viral images gallery. It was one of the image JSON dictionaries under the key `link`. So that means that URL came direct from the API already preformatted as a thumbnail URL. Why does this happen sometimes? I do admit the way I was going about this was incorrect and I have already fixed it in my app so thanks for that :) But maybe I am misunderstanding what the `link` key in the JSON means

Josh

@jasdev

unread,
Feb 4, 2015, 7:36:44 PM2/4/15
to im...@googlegroups.com
Ah yep, see the note in the Gallery Image model for the `link` field! For larger GIFs that were converted to video ( > 20MB), the original gif link isn't retained. In this case, the field is replaced with a thumbnail to keep backwards compatibility for apps! (if we replaced it with a video, it'd break things :P)


Sorry for the confusion!

Jasdev

josh...@gmail.com

unread,
Feb 4, 2015, 9:41:38 PM2/4/15
to im...@googlegroups.com
Thanks for clearing that up! I guess I should read the docs.. oops.

Josh
Reply all
Reply to author
Forward
0 new messages