A plugin which generates an invisible SVG of specific dimensions for use when lazyloading images in Craft CMS templates. Works with Craft 2. For Craft 3 support, check out mblode's fork.
Installation
- Unzip file
- Place
svgplaceholder
directory into yourcraft/plugins
directory - Install plugin in the Craft Control Panel under Settings > Plugins
Usage
{{ craft.svg_placholder.generate({height:500,width:'300'}) }}
Example
When used with Lazysizes:
<img class="lazyload" src="{{ craft.svg_placholder.generate({height:500,width:'300'}) }}" data-src="path-to-real-image-500x300.jpg" />