Embedding Tumblr

Get up to date with the goings on of the forum

Moderator: Jake

Post Reply
User avatar
Rommeltje
The man in charge
Posts: 13020
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Has thanked: 1343 times
Been thanked: 803 times
Contact:

Embedding Tumblr

Post by Rommeltje »

It is now possible to embed Tumblr posts! :w00t:

It's basically the same as embedding Youtubes. For example, if this is your Tumblr url:

worldofglovefetish.tumblr.com/post/112655251544/nacnac-toons-heres-one-out-of-two-panels-that-i

This is how you embed it:

[tumblr=112655251544][/tumblr]

Resulting in:
[tumblr=112655251544][/tumblr]

:yay:
User avatar
SexySurgical
Rommeltje's Deputy
Posts: 11821
Joined: Wed Nov 24, 2010 1:04 am
Location: Dutchieland
Has thanked: 1956 times
Been thanked: 402 times
Contact:

Re: Embedding Tumblr

Post by SexySurgical »

Very najs. Aai lajk.
User avatar
Rommeltje
The man in charge
Posts: 13020
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Has thanked: 1343 times
Been thanked: 803 times
Contact:

Re: Embedding Tumblr

Post by Rommeltje »

Oh, hold up! :$ Sorry, this only works for post from the worldofglovefetish-Tumblr. I can't make it work every blog. :-/

My apologies. Well, at least we can embed some Tumblr posts now then.
User avatar
glovemad
Regular poster
Posts: 50
Joined: Mon Nov 14, 2011 1:01 pm
Location: United Kingdom
Been thanked: 1 time
Contact:

Re: Embedding Tumblr

Post by glovemad »

*puts programmer's hat on*

I'm sure there must be a way of specifying the source user as well, probably would need the phpBB mod (I'm guessing that's what it is?) to accept both together in the BB code, maybe something like:

Code: Select all

[tumblr=username:123456789][/tumblr]
Obviously, a little bit more complicated than just a post ID, but coming from a programming background, adding the username shouldn't be a difficult task, unless for some reason you've had to add an API key or secret to the mod to get it to work, in which case, then it's a bit more complicated.

If you want a second opinion to get it to work for all users, I may be able to assist :), unless you already have someone that can sort that stuff out!

*takes hat off*
User avatar
Rommeltje
The man in charge
Posts: 13020
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Has thanked: 1343 times
Been thanked: 803 times
Contact:

Re: Embedding Tumblr

Post by Rommeltje »

No, the problem is that the embed code generates a second string of numbers for the username. It'd be a bit much to ask people to find those numbers and add them in the tags.

As it is now, you only have to fill in the ID-tag of the post.

This is the embed code that needs to be 'BBCodified':

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/112655251544" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://worldofglovefetish.tumblr.com/post/112655251544">http://worldofglovefetish.tumblr.com/post/112655251544</a></div><script async src="http://assets.tumblr.com/post.js"></script>
To turn that into BBCode, first I have to replace the ID with an identifier token:

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/{IDENTIFIER}" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://worldofglovefetish.tumblr.com/post/{IDENTIFIER}">http://worldofglovefetish.tumblr.com/post/{IDENTIFIER}</a></div><script async src="http://assets.tumblr.com/post.js"></script>
The corresponding BBCode then looks like this:

Code: Select all

[tumblr={IDENTIFIER}][/tumblr]
I could add a token to make it so that you could also fill in the username. The html part would then look like this:

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/{IDENTIFIER2}" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://{IDENTIFIER1}.tumblr.com/post/{IDENTIFIER2}">http://{IDENTIFIER1}.tumblr.com/post/{IDENTIFIER2}</a></div><script async src="http://assets.tumblr.com/post.js"></script>
With the BBCode looking like this:

Code: Select all

[tumblr={IDENTIFIER1}]{IDENTIFIER2}[/tumblr]
But that doesn't work, because apparently, there's information about the username in either this part of the code:

Code: Select all

https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/
Or this:

Code: Select all

data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"
And there's no way to generate that with a BBCode. At least none that I know of. If you do know how to do that, I'd love to hear it.

Either way, thanks for offering your help!
User avatar
glovemad
Regular poster
Posts: 50
Joined: Mon Nov 14, 2011 1:01 pm
Location: United Kingdom
Been thanked: 1 time
Contact:

Re: Embedding Tumblr

Post by glovemad »

Hmm, OK that is interesting. I didn't consider they'd end up encoding the username/userid in some way in the embed URL. Perusing the post.js file it looks like the crucial detail is that bit in the data-href attribute, as it looks like the data-did attribute is optional. I can't quite figure out how that encoded string relates back to the user in some way. Can't find any other posts about it either, apart from another developer thinking about the same issue, but with no response.
Post Reply

Return to “News”