Caption not showing up in image
Permalink 2 users found helpful
Hello
I'm new to C5 and have just taken over a site to look after. I'm doing OK except for one thing. I have a page of reviews which is created by image blocks. I can add a new block and see the image, which links to it's child page with no problem. But the alt text/caption does not show up. I've looked at the other block settings but it all looks identical. Any thoughts as to what might be the problem please?
I'm new to C5 and have just taken over a site to look after. I'm doing OK except for one thing. I have a page of reviews which is created by image blocks. I can add a new block and see the image, which links to it's child page with no problem. But the alt text/caption does not show up. I've looked at the other block settings but it all looks identical. Any thoughts as to what might be the problem please?
Could we see this live please to help diagnose the problem?
Alt text is for people who have images disabled, or disabled people, it doesn't actually add anything under the image
http://www.laviniabrown.co.uk/index.php/press/
Since this is a live site I don't really want to release the page with the missing text, but it's this page I need to add another review to. The new block with its image appears no problem - just no text.
I know alt text is normally for accessibility purposes but there are only four options to complete on the Edit box: image / image on state / image links to URL / Alt text/Caption. For the previous blocks it does appear that the alt text creates the block text, unless I am missing something - which I obviously am!
Thanks
Since this is a live site I don't really want to release the page with the missing text, but it's this page I need to add another review to. The new block with its image appears no problem - just no text.
I know alt text is normally for accessibility purposes but there are only four options to complete on the Edit box: image / image on state / image links to URL / Alt text/Caption. For the previous blocks it does appear that the alt text creates the block text, unless I am missing something - which I obviously am!
Thanks
You need to edit the Image block's controller.php (first copy it from /concrete/blocks/image/ to /blocks/image/)
Here's what I did:
Just before this at around line 91:
insert this:
This will create a DIV with the class 'caption' below your image. You can style that whatever way you like.
Here's what I did:
Just before this at around line 91:
$img .= "/>";
insert this:
$img .= "<div class=\"caption\">{$this->altText}</div></div>";
This will create a DIV with the class 'caption' below your image. You can style that whatever way you like.
Hi melat0nin,
I am really new in this. Where do I find the controller.php? and how so I copy it to the place you indicate?
Thank you,
I am really new in this. Where do I find the controller.php? and how so I copy it to the place you indicate?
Thank you,
You can find it within \yoursiteroot\concrete\blocks\image
to \yoursiteroot\blocks\image
to \yoursiteroot\blocks\image
Gracias/ Thank you Pritam
here's the html5 way I did it (replacing existing code block in blocks/image/controller:
hope this helps someone on the search!
$img = "<figure><img border=\"0\" class=\"ccm-image-block\" alt=\"{$this->altText}\" src=\"{$relPath}\" {$sizeStr} ";//add figure html5 $img .= ($align) ? "align=\"{$align}\" " : ''; $img .= ($style) ? "style=\"{$style}\" " : ''; if($this->fOnstateID != 0) { $fos = $this->getFileOnstateObject(); if ($this->maxWidth > 0 || $this->maxHeight > 0) { $thumbHover = $ih->getThumbnail($fos, $mw, $mh); $relPathHover = $thumbHover->src; } else { $relPathHover = $fos->getRelativePath(); } $img .= " onmouseover=\"this.src = '{$relPathHover}'\" "; $img .= " onmouseout=\"this.src = '{$relPath}'\" "; } $img .= ($id) ? "id=\"{$id}\" " : "";
Viewing 15 lines of 17 lines. View entire code block.
hope this helps someone on the search!
Very useful, was searching how to show caption text beneath images. This HTML5 code does the job.
For those who found this thread by searching for caption for images: there is free add-on available at the marketplace that does what the core image module is still lacking: "Lightboxed Image" with an optional lightbox.
http://www.concrete5.org/marketplace/addons/lightboxed-image...
http://www.concrete5.org/marketplace/addons/lightboxed-image...