MyBB Community Forums

Full Version: GFYcat embed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
this can probably be improved upon, but I couldnt find this anywhere and made my own MyCode for it in a quick 10 minute session this morning.

Could probably expand in the future to replace all .gif's links posted with;
"" before a url will automatically fetch and convert it.

I think I may be able to whip a plugin up to do that but my php skills are minimal.

gfy are far smaller than .gifs (and have some other uses)
so on gif-heavy forums you can save your members some bandwidth


This somewhere in the template
 (function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = '';
    s.parentNode.insertBefore(g, s);
}(document, 'script'));

GFYcan link example;

Gif Size: 4.3 MB
Gfy Size: 457.8 kB
Compression: 9.6 to 1

We only want the part after the slash, so we use;
Regular Expression;

<img class="gfyitem" data-id="$1" />

and then this code will embed it;

Any suggestions or improvements would be welcome.

edit; fixed the Expression, as it wouldnt embed anything with the http