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

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?).

Imgur

In any case, yay for developers!

11개의 좋아요

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개의 좋아요

Looks like it doesn’t work anymore :frowning:

Related:

2개의 좋아요

That’s because:

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

3개의 좋아요

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개의 좋아요

Done

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

1개의 좋아요

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개의 좋아요

This is now fixed via:

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

3개의 좋아요

http://imgur.com/a/tQEj0

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개의 좋아요

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

1개의 좋아요

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개의 좋아요

This no longer works? It is throwing 404 error, and prints the url as it is
http://imgur.com/a/PWgY0?gallery

42 AM

Can you repro this @jomaxro?

1개의 좋아요

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

https://imgur.com/a/tQEj0

cc @techAPJ

5개의 좋아요

It’s fixed on latest.

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

9개의 좋아요