View Full Version : gfycat bbcode?
MattGarner
11-26-2014, 05:12 PM
Anyone know a way of being able to embed the content from gfycat into posts/threads via BBCode? This vbulletin forum seems to have done it but not sure what code they have used:
http://hfboards.hockeysfuture.com/showthread.php?p=83080515
This page tells basically how to do it: http://gfycat.com/about
You need to add some javascript to the page. The page you linked to appears to have it added to the end of the header template. If you want to use a plugin to do it instead, you could use hook location parse_templates and add it to the headinclude_javascript template hook, maybe like:
$template_hook['headinclude_javascript'] .= " <script>
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'http://assets.gfycat.com/js/gfyajax-0.517d.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script> ";
then you can create a custom bbcode, and the replacement would be
<img class="gfyitem" data-id="{param}" />
MattGarner
11-26-2014, 07:48 PM
This page tells basically how to do it: http://gfycat.com/about
You need to add some javascript to the page. The page you linked to appears to have it added to the end of the header template. If you want to use a plugin to do it instead, you could use hook location parse_templates and add it to the headinclude_javascript template hook, maybe like:
$template_hook['headinclude_javascript'] .= " <script>
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'http://assets.gfycat.com/js/gfyajax-0.517d.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script> ";
then you can create a custom bbcode, and the replacement would be
<img class="gfyitem" data-id="{param}" />
Thanks for that - Do you know if there is a way to keep them at a certain size or something? In case a big one was posted and it looks a bit silly when posted.
I don't know, that page doesn't say anything about limiting the size. It might be possible to add some html to the bbcode replacement to set a max size, but I'm not really an html person. Hopefully someone else will know.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.