Responsive images are a way to improve the speed your website takes to load higher resolution images. It allows the browser to decide what images the device is capable of displaying and only loads those. That way you can upload beautiful 3000 pixel wide photographs to your site and people with a 480 pixel wide mobile device display will still be able to browse your site quickly.
This plugins is a drop-in implementation of the srcset attribute. After you installed the plugin, there are no options needed. It will just work with your existing kirby tags and add automatically generated smaller sizes to your images.
@Designscheu asked me about this on Twitter yesterday.
Your code only works if the page you want to get the images from is the current page. If you want to use the Kirbytag in a foreach loop for example, you can use something like this.
Ah, looks like I misunderstood how kirbytag works. It seems as if it doesn’t use the default attributes set via kirbytext::$tags['image']. Not sure though.
For now the only workaround I can offer is manually setting the attributes like so:
Yeah you’re right. Although it has, if it is defined in the Blueprint - so somehow it should transport these fields if it is meant to replace the image tag.
Well, the original Tag doesn’t do that either, so I guess I need to stick to my workaround.
Just wanted to let you all you know that I just released version 1.1 that includes two features that were requested by users. It let’s you link to a specific size like so
(image:workflow@3x.jpg link:small width:1244)
And you can control what is used for the src attribute by setting a default size
Hi @jancbeck,
I’m using this plugin but I got this error:
Fatal error: Can’t use method return value in write context in /home8/laprinci/public_html/landscapestories/site/plugins/responsive-images.php on line 90