Announcement

#1 2016-01-16 04:41:45

wgibbs
Member
2016-01-16
3

How to show descriptions instead of filenames under thumbnails

Piwigo is terrific -- just the tool I need to set up an archive of historical photos for my extended family.

I'd like to configure it to show text from the "description" metadata field below each thumbnail image in album view, however, rather than the image filename. I have searched the forums for advice on how to alter local/config/config.inc.php or the template files (I'm using the Sylvia theme) to do this; that search turned up nothing that works, however.

I have attached a couple screenshots of my gallery to clarify the behavior I want. The first screenshot shows the gallery currently; rather than captions like "c%25201920%2520Mary%2520Ann%2520Fauber%2520Watts.jpg" under the thumbnails, I want whatever text shows up in the "Description" field on the photo properties page, as seen in the second screenshot -- for example, "1930?? Catherine Arbuckle Smith grandmother of William Wayt Gibbs III".

I'd also like that description text only (and not also the filename) to appear in the tooltip that pops up on the englarged photo when you hover the mouse over a thumbnail image. (I'm using the Image Preview plugin.)

I imagine there is some simple file modification I can make somewhere to swap description text for filenames, but I need help figuring out what the modification should be and where to make it.

Many thanks for whatever assistance you can offer!

Piwigo version: 2.7.4
PHP version: 5.5.43
MySQL version: 5.5.45
Piwigo URL: http://gibbslegacy.com/gallery

Offline

 

#2 2016-01-16 16:27:01

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: How to show descriptions instead of filenames under thumbnails

Hi,

I don't have a solution but maybe a temporary workaround: Switch of "display the picture name" in the "Image Preview" plugin and use the "Thumbnail Tooltip" to show the text you want. Granted, doesn't look as nice as an integrated solution but shows the data :-)

HTH,
Thomas

Offline

 

#3 2016-01-17 02:07:14

CChiappa
Member
2014-07-25
6

Re: How to show descriptions instead of filenames under thumbnails

I copied default/themes/template/thumbnails.tpl  to local/templates/thumbnails.tpl and changed the line that said:

Code:

    <span class="thumbName">{$thumbnail.NAME}</span>

into something like:

Code:

    <span class="thumbName">{$thumbnail.NAME}</span>
    {if isset($thumbnail.DESCRIPTION)}
        <span class="thumbDesc">{$thumbnail.DESCRIPTION}</span>
    {/if}

And maybe I had to register this override somewhere in the Administration control panel?  Don't remember.  But that works for me at least.
There were some other hints about using the on-the-fly template editing capability to replace NAME with DESCRIPTION, but I found that too limiting.

Offline

 

#4 2016-01-17 08:18:49

wgibbs
Member
2016-01-16
3

Re: How to show descriptions instead of filenames under thumbnails

Cchiapa, thanks so much. Your reply provided the clues I needed to make the changes I wanted.
For the benefit of others, here was the solution that worked for me:

1. Copy the file themes/default/template/thumbnails.tpl to /template-extension/mydir/thumbnails.tpl

2. Edit /template-extension/mydir/thumbnails.tpl and replace the line

Code:

<span class="thumbName">{$thumbnail.NAME}</span>

to

Code:

      {if isset($thumbnail.DESCRIPTION)}
            <span class="thumbDesc">{$thumbnail.DESCRIPTION}</span>
        {/if}
        {if !isset($thumbnail.DESCRIPTION)}
             <span class="thumbDesc">{$thumbnail.NAME}</span>
           {/if}

3. Go to the configuration screen, choose the templates section, and you should see the file you modified listed in the "Substitutes (customized templates)" column. In the row for your modified template, choose thumbnails.tpl for the original template and "Sylvia" (or whatever theme you are using) for the bound theme. Then submit to save the changes.

Now the modified template code will be displayed in place of the original, and this change should persist across upgrades.

Still working on how to make a comparable change in the ALT "tooltip" text shown in the pop-up generated by the Image Preview plugin. I'll post a solution to that if I find one.

Hats off to the Piwigo community for such a quick and helpful response!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact