glowing-bear
glowing-bear copied to clipboard
Integrate imgur album viewer
See reddit for example
That's a bit tricky.
For a given single image ID (let's use 2YZA3CP
here), we can have many URLs like:
http://imgur.com/gallery/2YZA3CP
http://imgur.com/2YZA3CP
With the following form, only the image is displayed (this should be handled by the generic image plugin):
http://i.imgur.com/2YZA3CP.png
http://i.imgur.com/2YZA3CP.gif
http://i.imgur.com/2YZA3CP.jpg
http://i.imgur.com/2YZA3CP.jpeg
http://imgur.com/2YZA3CP.png
http://imgur.com/2YZA3CP.gif
http://imgur.com/2YZA3CP.jpg
http://imgur.com/2YZA3CP.jpeg
But for a gallery ID (e.g. 8E66G
), with have those URLs:
http://imgur.com/gallery/8E66G
http://imgur.com/a/8E66G
http://imgur.com/a/8E66G/all
http://imgur.com/a/8E66G/embed
http://imgur.com/a/8E66G/embed#0
...
This seems like a good place to leverage the imgur api. It would require registering a client account for access, would you be interested in building this into glowing-bear?
Bump. I'm just going to include what I've sad on IRC so that I don't have to retype everything.
<─> Tuesday (May 23) <Techman> 03:29:05 AM <+lorenzh> It's issue #10, Techman :D <Techman> Does Imgur not already have some sweet sweet embed code available on their website? <Techman> Maybe take notes from https://github.com/honestbleeps/Reddit-Enhancement-Suite/blob/master/lib/modules/hosts/imgur.js ? <Techman> RES seems to handle it pretty well so that might be worth taking a look at <Techman> Well actually, it doesn't seem too difficult at all <Techman> I'm not a regex kind of person so I can't help with matching, but it appears to be basically something like this: <Techman> <blockquote class="imgur-embed-pub" lang="en" data-id="a/ALBUM_ID"><a href="//imgur.com/ALBUM_ID">ALBUM_TITLE</blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> <Techman> I'm not sure if you need to load the script more than once, but I'd hope that you don't <Techman> So that way you just generate that HTML <blockquote> with the proper stuff in it, inject it into the HTML, and the script should turn it into the proper embed. <Techman> Of course, I think some people have already thought of this and they have seen something that I haven't seen, but so far this looks to be simple.
Might be worth looking at this again now since imgur behavior has changed since this issue was posted in 2013 because a lot of single image URLS are now located at the imgur.com domain rather than i.imgur.com. These types of URLs can be single images or albums, and currently do not get the embedded treatment in glowing bear at all.
More current guidance about parsing can be gleaned from a Chrome/Firefox extension called Imagus. It shows images inline and has a parser for imgur (among many other websites) that includes all variations of urls about imgur.
If this is still of actuality, I can try to do something.
Edit: currently working on it.