Show bigger image on click1 user found helpful
I hope anyone can help me out, because I'm struggling with this for quite a while already.
would it not be easier to use one of the Lightbox add-ons from the marketplace?
This one is superb, and its free!
It seems like an excellent add-on, but can I also apply this to images which are contained within a regular content block?
Sorry, I don't believe you can, the only advice I can give on this front really, is if you are creating your own theme, build in some editable areas where you are planning on putting your pictures so you can have specific text and picture blocks.
I think you may be a little limited for options with images inside content blocks.
The other thing you can try is, as you already have the clickable thumbnail already sorted you could just add a second full size image to the file manager, click on the image and look at the properties tab and it does give you the full url to the image, so to sum up you would add your thumbnail image in file manager, add a full size version in file manager too, then set up your thumbnail in a content block and give it a link to the larger image, you may also be able to set up some custom jquery to add a lightbox effect, when you add an image through the filemanager it does have an advanced tab where you can add classes so your lightbox script could hook into the class added there.
Personally I never add images into content blocks. I simply break the content up into smaller chunks using multiple blocks and layouts.
So if I need an image alongside some text, no problem - just add a 2 column layout with 20px of spacing, add a content block on the left and an image block on the right. Drag the width slider until it looks balanced.
This way you can use a lightbox image block, and add a custom template to the image if you need to.
If you use this approach you will hardly ever need to insert images into content blocks, and you get a much better variety of blocks to choose from.
Where I tend to run into problems is when I need to programatically loop through blocks to do some extra processing - layouts add extra complications to that and they behave differently to areas with various area functions. Also the fact that you can't use layouts in stacks makes them a little less useful. But overall I haven't run into any serious problems and I'm running I guess 20 or so Concrete5 sites.
I finally ended up solving my problem through adding an image and setting a data attribute on that image containing the original URL. Whenever I click the image it will open a fancybox showing the original image from the data attribute.
To everyone... Thanks for pointing me into some unexplored directions.
I just find it a lot cleaner to manage lots of smaller blocks rather than putting everything into one large content block.
It also opens the door for more complex internal content designs, which is something my clients do a lot.
But your caution is noted and thanks again for that, I'll steer clear of doing anything too clever using the layouts system.