Closed Fazarel closed 2 years ago
Yeah, it would improve performance and I already thought about it. And I'm aware of how this is done in glightbox. However, I couldn't find a way to do it in my plugin, without altering the syntax.
The idea of this plugin is to just wrap some [gallery]
bbcode around existing images. I don't want other tags to be needed or having the existing image bbcodes altered. This way, it is a drop-in replacement for existing image listings.
Processing of image code is done in Grav core. All my plugin gets from this shortcode:
![Alt 3](photo-1487260211189-670c54da558d.jpg "Title 3")
![Alt 4](photo-1500239038240-9b3b8bac73c3.jpg "Title 4")
via Shortcode core is this:
</p>
<img title="Title 3" alt="Alt 3" src="/user/pages/demo/02.gallery-plusplus/photo-1487260211189-670c54da558d.jpg" />
<img title="Title 4" alt="Alt 4" src="/user/pages/demo/02.gallery-plusplus/photo-1500239038240-9b3b8bac73c3.jpg" />
</p>
It is pre-rendered html. No chance for me to apply something like this in twig
{{ page.media['sample-image.jpg'].resize(400, 200).html()|raw }}
to it.
So, there is no way to automatically add thumbnail size images. And as stated: I don't want the user to bother adding a second image manually.
If you've got a clever idea how to achieve this, I'd love to hear it. 👍
Suggestion for enhancement.
In order to optimize the page loading, allow to indicate 2 images: a small one and a large one. Or define a nomenclature to use 2 images (for example image.jpg and image_small.jpg in the same folder). The objective being a result in html as in this example:
In addition GLightbox allows the use of videos. Being able to specify 2 files would offer the possibility of an image in the gallery that links to a video in GLightbox.
If I develop a solution I will post it. For now I submit this suggestion for consideration...