MyBB Community Forums

Full Version: Embed instagram post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello world, 

This is my first post, i'm a french admin on a small friends private forum and i just fork from something found on a phpbb help forum. A code for embedding an instagram post in forum. 

Here is the regex : 
\[insta\]https://www.instagram.com/p/(.*?)/\[/insta\]

and the replacement code : 
<iframe src="//instagram.com/p/$1/embed/captioned/" width="612" height="710" frameborder="0" scrolling="auto" allowtransparency="true" style="border: 1px #b2a998 solid; border-radius: 5px; box-shadow: 0px 0px 7px 0px rgba(106, 101, 91, 0.5); "
 ></iframe>

remove "captioned/" if you want.

Hope you enjoy it. 
Tell me if you find a better way (or if you have an idea to improve it in any way)
you user just have to copy/paste the share url of an instagram post and put it in [insta] [/insta] tags.
With some CSS (border, light shadow), it can be nicely integrated to your forum posts, i put it directly in replacement code but you cant have it here : 

border: 1px #b2a998 solid;
border-radius: 5px;
box-shadow: 0px 0px 7px 0px rgba(106, 101, 91, 0.5);

[Image: Capture_d_e_cran_2017_02_09_a_13_09_55.png]

Have a nice day.
N.
Why don't just use the url as MyCode ?
regexp Wrote:https://www.instagram.com/p/(.*?)/
'Cause sometimes you want a link and sometimes you want embed ?
I'm trying to use your code, Neo[blue],  but it doesn't work on my forum Sad
I also tried your code Crazycat (hello ! the world is so small !! Big Grin) but with no success Sad

I'm new to myBB, I might have done some mistake, somewhere...?

OOps !

Forgot my previous message...I've forgotten the final slash...huhu ^^
(2017-03-16, 01:24 PM)myinnershelf Wrote: [ -> ]I'm trying to use your code, Neo[blue],  but it doesn't work on my forum Sad
I also tried your code Crazycat (hello ! the world is so small !! Big Grin) but with no success Sad

I'm new to myBB, I might have done some mistake, somewhere...?

OOps !

Forgot my previous message...I've forgotten the final slash...huhu ^^

Does it work now ?
Quote:OOps !

Forgot my previous message...I've forgotten the final slash...huhu ^^


Yes !! Smile
Perfect ! Smile
it doesnt work for me Sad why
So, it only works if I manually remove the last bit from the link
For example:
If I want to embed 

https://www.instagram.com/p/BYDVpZ3FGxV/?hl=en&taken-by=shireensungkar
 I have to remove 
?hl=en&taken-by=shireensungkar


Fair enough, for me, I suppose but it may be confusing to members trying to utilize it
It doesn't work. Nothing shows up.
works fine now.
thanks
Pages: 1 2