Imgur embeds broken

Imgur galleries used to show up with a nice onebox preview of the gallery, but this broke recently and just a link is shown. e.g.

I viewed this topic on Meta on May 26th and the preview was working, now it is not. The preview in the first post will show up if you try replying to that topic (or this topic), and pasting any imgur galley URL into the edit box, but you won’t see a preview for the URL you just pasted. The preview won’t be there if you refresh the page.

I saw the same behavior on a forum hosted at Communiteq (formerly DiscourseHosting) also on May 26th, when they were running 1.2. The behavior is still there this week with 1.3.

「いいね!」 1

It’s because Imgur changed it on their end.

Hmm, that doesn’t explain why it was working here but not at my Communiteq (formerly DiscourseHosting) forum at the same time (on May 26th). Is this broken until Imgur changes something back, or until Discourse releases a fix?

See @eviltrout’s answer here:

Here’s a little freaky magic for ya - you can get them working by attempting to reply with any imgur gallery URL.

obviously not a fix, nor real magic - sorry

このバグを再度提出しようとしていましたが、これを見つけました。

ただし、最後の投稿が示すように、埋め込みが突然表示されることがあります。したがって、Imgur が何をしているかに関わらず、Discourse も何らかの奇妙なことをしているはずです。

例えば、投稿の編集をクリックすると、ギャラリーが表示されます。



同様に、エディタにギャラリーリンクを貼り付けると表示されますが、改行すると消えてしまいます。


「いいね!」 1

Is this a timing issue in the composer, does typing a bit more kick it out of crazy mode ?

Not really, in fact right now I can’t even get it to appear at all.

@sam imgur embeds are using a <script> tag which gets excised from the final post by the html-sanitizer-bundle, but if you edit the post the script is loaded. we need a custom onebox for imgur albums.

「いいね!」 2

We should do this as Imgur is a customer. Can you add it to your list @techapj?

To be fair, it would’ve gotten done anyways, eventually. :stuck_out_tongue:

Okay, I just added custom Imgur onebox engine. Here are the features:

  • When Imgur image link is provided, it extracts the image and shows that, clicking on image will take you to original imgur link.

Imgur

  • When Imgur gif link is provided, it extracts the mp4 video source and shows the HTML5 video player (with controls/autoplay/loop).
  • When Imgur gallery link is provided, it extracts the first image from the gallery and shows that, clicking on image will take you to original imgur gallery link.

https://github.com/discourse/onebox/commit/9526fb1fa79aac912a920439b97058ccb7d4c438

(cc @eviltrout)

「いいね!」 4

A post was split to a new topic: Imgur album should have some indication that it’s an album