Gfycat is great for converting GIFs to quick-loading videos, but its regular embed code uses an iframe
and other superfluous code. This Kirbytext extension strips it down to the native video
element and a fallback .gif
.
Save this file as /site/tags/gfycat.php
<?php
kirbytext::$tags['gfycat'] = array(
'html' => function($tag) {
$gfyID = $tag->attr('gfycat');
return '<video poster="//thumbs.gfycat.com/'.$gfyID.'-poster.jpg" loop autoplay mute>
<source id="webmsource" type="video/webm" src="//zippy.gfycat.com/'.$gfyID.'.webm"></source>
<source id="mp4source" type="video/mp4" src="//fat.gfycat.com/'.$gfyID.'.mp4"></source>
<img src="//giant.gfycat.com/'.$gfyID.'.gif"></img>
</video>';
}
);
?>
Use it in your content pages like this (gfycat: ExhaustedVapidGorilla)
This code is also on GitHub