Image block lightbox

Permalink 1 user found helpful
Hi community,

this is my first time with concrete5 - it's a very good and simple cms - the docs are great but I can't find:

How to enable lightbox for the image block?

:) Thank you!

---
Edit:

Sorry, more informations:
- I use my own theme
- I use 5.7

 
mnakalay replied on at Permalink Reply
mnakalay
Hello,
the image block doesn't offer a popup functionality.

You can, however, insert an image in a content block, make it a link and choose to open the link in a popup
machomaaan replied on at Permalink Reply
Hi mnakalay,

thank you for this information.

But to the core team:
Why there is no option to open the image in a lightbox when using image block?

Thank you!
ramonleenders replied on at Permalink Reply
ramonleenders
Well, people could use either Bootstrap or Foundation. Both have different ways of opening a popup. And even if you use either of them, who says you want to use THEIR functionality. Maybe you want to include your own popup functionality, LightBox, LightBox2 or whatever other popup plugin there is available. This makes it pretty hard to know what to output to make it work for the plugin you are using.
machomaaan replied on at Permalink Reply
Yes, you are right! ;)

Are there docs for it (e.g. how to integrate lightbox2)?

Thank you!
ramonleenders replied on at Permalink Reply
ramonleenders
You should view that per plugin. So for LightBox2, look here:

http://lokeshdhakar.com/projects/lightbox2/#getting-started...

You can override the template of the "Image" block type, but getting your lightbox/popup plugin to work is priority #1. Then change the template to how it should be.
mnakalay replied on at Permalink Best Answer Reply
mnakalay
it would probably be simpler to use Magnific Popup since it is included with Concrete5.
It is also a very solid one that works pretty much flawlessly.
machomaaan replied on at Permalink Reply
Oh cool, Magnific Popup is included? Great!
I think I need to load it in my page_theme.php (register assets)?!
JohntheFish replied on at Permalink Reply
JohntheFish
mnakalay replied on at Permalink Reply
mnakalay
adding it to page_theme.php is an option but it depends on what you want to do.

If you do it that way, the script will load on every page unless you write dome logic to select specific pages.

But since you are going to have to write a template for the image block anyway, to add settings for magnific popup, you can simply require the asset (the lightbox script) from the template itself.
machomaaan replied on at Permalink Reply
Great job guys!

Thank you very much!
dessisan replied on at Permalink Reply 1 Attachment
I'm currently building a website with concrete5 Version 8.4.3. The rich text editor (CKEditor 4) in the content block ships with a plugin called 'concrete5 Link', see comment about it here:

https://documentation.concrete5.org/editors/dashboard/system-and-mai...

The 'concrete5 Link'-plugin provides an image lightbox creation, which can be activated by choosing the 'lighbox'-Option in the Dropdown-Menu 'target' of the link attributes. This way clicking on the image opens a lightbox, which inspecting the created markup seems to rely on 'Magnific Popup' shipped with the concrete5-package.

Important: The 'lightbox'-Option is NOT in the dropdown of the link-option of the 'image'-plugin. You have to put the link on the image by clicking on the 'link'-icon in the text-editor-menu-bar. There you can find the 'lightbox'-Option (see screenshot in the file attached).

Being no programmer, I spent two days based on this thread trying to figure out a workaround for the missing lightbox-option in the core image block, and was already on the way to try 'copy-paste-image-block-to-packages-folder' + 'page_theme.php > requireAsset('core/lightbox') + 'code-analyzing-"finicking" in the copied image block'.

Happily enough this morning I came through the built-in-'lightbox'-Option in the content block, which saves me uncounted hours of 'coding-trials'.

So I thought to post this here for other people looking for information about built-in-lightbox-facilitiy in concrete5.
juddc replied on at Permalink Reply
juddc
Nice Find. Why they haven't added this into the image block is beyond me.
dessisan replied on at Permalink Reply
Reading the thread today again, I realize, that mnakalay in the very first reply on nov 29, 2016 to the question of the thread already pointed everything out in just one sentence, what I described later in many words in detail …:

You can, however, insert an image in a content block, MAKE IT A LINK and CHOOSE TO OPEN the link IN A POPUP

By that time, unfortunately I didn’t catch right, what he meant. Anyway: at last we know now, what to do.
;-)
hammermedia replied on at Permalink Reply
We still didn't get it working properly. It works only with cache turned off for that particular block as @concreteowl suggests.

https://www.concrete5.org/community/forums/customizing_c5/lightbox-w...

Can anybody confirm, working perhaps in another theme than Elemental?
dessisan replied on at Permalink Reply
Yes, I can confirm: the concrete5-built-in lightbox, activated by putting a link on an image and opening it as popup / lightbox, doesn’t work correct, when blockcache in the cache settings is turned on.
I experience this in three different websites, each of them built with an individual theme, two of them running concrete5 version 8.5.5, one of them version 8.5.2. When blockcache is turned on, the image doesn’t open in an overlay as lightbox, instead it opens in a separate window of the browser, similar to as if you had right-clicked in the browser on the image and chosen to show the image in a separate tab of the browser.
I realized the bug while testing after some developing work. Strangely in first place I thought it had to do with two-column-design, because the bug showed up only after revisiting the same page with the two-column-design. Later I realized, that the bug showed up also in pages without two-column-design. Also strangely on some pages the bug shows up instantly after turning blockcache on, in other pages only several hours or days after turning blockcache on. On the other side the bug disappears instantly after turning blockcache off and clearing the cache.
Hope this helps a little in tracking the bug. Sorry for reply with delay, I do webpublishing work only from time to time.