TIL: Discourse can embed imgur albums and galleries

Continuing the discussion from Oneboxing: Albums from imgur get a cute kitten as onebox

We just found this feature by accident on our forum today. Here’s an embedded imgur gallery, simply by entering the link http://imgur.com/a/PWgY0?gallery

So nifty! I dunno if the Discourse devs did something specifically for imgur recently or if it’s just a result of imgur’s new and improved embeds initiative (are they more OpenGraph compatible now?).

http://imgur.com/blog/2015/04/07/embed-your-post-anywhere/

In any case, yay for developers!

11 Likes

We’ve supported this for a while. I checked their oembed support for galleries and they produce the nice formatting so I let it through :smile:

7 Likes

Looks like it doesn’t work anymore :frowning:

Related:

2 Likes

That’s because:

https://community.imgur.com/t/imgur-album-no-longer-embedded-in-post/11711/11?u=ajalan

But I made some changes recently, so it should not be broken anymore…

https://community.imgur.com/t/imgur-album-no-longer-embedded-in-post/11711/24?u=ajalan

3 Likes

I just checked on http://try.discourse.org/ and it still doesn’t work. I see only the first image form the gallery.

That’s because Onebox gem version hasn’t been updated after that commit.

@zogstrip can you please update onebox version?

2 Likes

Done

1 Like

Imgur albums are not getting (properly) oneboxed anymore… :frowning:

It seems like Imgur changed metadata info recently and there is no way to detect if the link is an image or album by looking at just metadata info.

Previously there used to be multiple twitter metadata image tags to indicate that the link is an album, but they are not present anymore.

The only way to work around is this is to use Imgur API, but the API only allows access to registered application, as per:

This version of the API, version 3, uses OAuth 2.0. This means that all requests will need to be encrypted and sent via SSL/TLS to https://. It also means that you need to register your application, even if you aren’t allowing users to login.

5 Likes

This is now fixed via:

https://github.com/discourse/onebox/commit/fcec52bc6c69ba3e76611c07480ac0d12892d160

3 Likes

I use this link
http://imgur.com/a/tQEj0 i get the first image, but i am not able to scroll over the images.

Onebox does not support full Imgur Album embed, it only indicates that the link is an Album.

2 Likes

Looks a bit weird on iPad, the top bar is full width, but the image is not?

1 Like

I noticed that on my MacBook too. Fixed via:

https://github.com/discourse/discourse/commit/c13d8176b537eaa3ce8770b56e1a70e8e29812c4

and

https://github.com/discourse/onebox/commit/97676311bcc3b850ea1cc10619365a9bbf1a917e

5 Likes

This no longer works? It is throwing 404 error, and prints the url as it is

Can you repro this @jomaxro?

1 Like

Yep, right here on Meta. Getting a raw link and a 404 console error.

https://imgur.com/a/tQEj0

cc @techAPJ

5 Likes

It’s fixed on latest.

https://github.com/discourse/onebox/commit/85249fd81a68cd3073b438a56ad7d87d9d73cd58

9 Likes