emo Image Caption in Gallery Popup?

More
10 years 1 month ago #706

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.

More
10 years 1 month ago #707

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.

More
10 years 1 month ago #708

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.

More
10 years 1 month ago #711

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): ?>
Add
<?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=""
to
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.

The following user(s) said Thank You: mavik

Please Log in or Create an account to join the conversation.

Time to create page: 0.042 seconds
Powered by Kunena Forum