Image Caption in Gallery Popup?
- mavikfan2015
-
Topic Author
- Offline
- Новый участник
-
- Posts: 5
- Thank you received: 1
Hi,
I would like to show captions in the gallery popup (PRO version).
In the popup window for images in an article, the ALT attribute of the image can be used as image caption, but in gallery popups the plugin gets the images from a folder so there is no ALT attribute.
Can mAvik thumbnails show captions in gallery popup?
Thanks!
Please Log in or Create an account to join the conversation.
Hi,
I'm sorry, but not.
But I will try add this function in future versions.
Please Log in or Create an account to join the conversation.
- mavikfan2015
-
Topic Author
- Offline
- Новый участник
-
- Posts: 5
- Thank you received: 1
Ok, I will write a code mod so that the gallery can obtain image title and description from IPTC data in the image, and display as caption, similar to ALT attribute for images in articles.
Stand by...
Please Log in or Create an account to join the conversation.
- mavikfan2015
-
Topic Author
- Offline
- Новый участник
-
- Posts: 5
- Thank you received: 1
A simple code mod to be able to make gallery pop-up images (PRO version only) display the image IPTC data title and description as a caption.
The good news is: because mAvik Thumbnails is implemented properly according to Joomla design, this can be done as a template override, so you don't need to edit core mAvik code which will get lost on update. Thank you Vitaliiy!
See
Joomla Docs (Layout Overrides)
for details how to override a plug-in.
Take a copy of
- plugins/content/mavikthumbnails/tmpl/gallery.php
into
- templates/[template]/html/plg_content_mavikthumbnails/
Edit in there:
After
<ul class="gallery">
<?php foreach ($this->images as $src): ?><?php
$image_local_url = substr ( $src , strpos ( $src , JURI::base() ) + strlen ( JURI::base() ) );
$iptc_title = '';
$iptc_description = '';
$size = getimagesize ( $image_local_url, $info );
if(isset($info['APP13']))
{
$iptc = iptcparse($info['APP13']);
if(is_array($iptc))
{
if(isset($iptc["2#005"][0]))
{
$iptc_title = htmlentities ( $iptc["2#005"][0] );
}
if(isset($iptc["2#120"][0]))
{
$iptc_description = htmlentities ( $iptc["2#120"][0] );
}
}
}
if ( ( $iptc_title !== '' ) && ( $iptc_description !== '' ) )
{
$iptc_description = ' - ' . $iptc_description;
}
?>Then change
alt=""alt="<?php echo ( $iptc_title . $iptc_description ); ?>"Note! this cannot handle single-quote characters in the IPTC data - but double-quotes are fine and some other characters.
Note also, your installation may differ in UTF-8 encoding, PHP version etc.
Please Log in or Create an account to join the conversation.