Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Embed instagram post
#1
Photo 
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 : 
Code:
\[insta\]https://www.instagram.com/p/(.*?)/\[/insta\]

and the replacement code : 
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 : 

Code:
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.
Reply
#2
Why don't just use the url as MyCode ?
regexp Wrote:https://www.instagram.com/p/(.*?)/
[ABP Central] - [MyBB 1.8 mods]
Do not ask me help through PM
Reply
#3
'Cause sometimes you want a link and sometimes you want embed ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)