Announcement

#1 2021-02-04 17:04:24

a1tim
Member
2021-02-04
2

How can I create and display an image Property?

Hello,

Anyone know how I can display the Name (also called Title) of an image in the theImageAndInfos page (the page that shows one photo - it displays when you click a thumbnail.)

Configuration -Display has toggles for several properties. But it does not control the display of "Title" - which can be set in Manage Photo


System Info:
    Piwigo 11.2.0
    Operating system: Linux
    PHP: 7.3.23 (Show info) [2021-02-04 16:00:05]
    MySQL: 5.7.32 [2021-02-04 16:00:05]
    Graphics Library: External ImageMagick 6.9.10-68


Site URL with image opened: http://www.gallery.corkcameragroup.net/ … category/6

It shows Author and the name of the original file - such as " _5220566-DXOGalTest.jpg" But I want its Title, which will be a more descriptive name e.g. "Dandelion by the coast"

Offline

 

#2 2021-02-04 19:36:47

TOnin
Member
1970-01-01
106

Re: How can I create and display an image Property?

Hello,
you can edit your template and get the title variable in the image porperties list.

For instance with default theme, I suggest editing (piwigo)/themes/default/template/picture.tpl,
and then going to line 172...

Code:

<dl id="standard" class="imageInfoTable">
{strip}
  {if $display_info.author and isset($INFO_AUTHOR)}
  <div id="Author" class="imageInfo">
    <dt>{'Author'|@translate}</dt>
    <dd>{$INFO_AUTHOR}</dd>
  </div>
  {/if}

... in order to insert a div block for title display.

Code:

<dl id="standard" class="imageInfoTable">
{strip}
  {if isset($current.TITLE)}
  <div id="Title" class="imageInfo">
    <dt>{'Title'|@translate}</dt>
    <dd>{$current.TITLE}</dd>
  </div>
  {/if}
  {if $display_info.author and isset($INFO_AUTHOR)}
  <div id="Author" class="imageInfo">
    <dt>{'Author'|@translate}</dt>
    <dd>{$INFO_AUTHOR}</dd>
  </div>
  {/if}

In the future, one can imagine this to be made part of Piwigo "out of the box".

Offline

 

#3 2021-02-04 20:15:45

TOnin
Member
1970-01-01
106

Re: How can I create and display an image Property?

Beware, my suggestion is not compatible with Manage Properties Photos extension: https://piwigo.org/ext/extension_view.php?eid=783
Modifying code is not a so good idea, it can breaks things relying on previous state, like extensions. It's better to provide an extension, or improve existing ones.

Offline

 

#4 2021-02-09 10:43:15

a1tim
Member
2021-02-04
2

Re: How can I create and display an image Property?

Thank you so much for your suggestions @TOnin
I really appreciate you including the bit of code, since my PHP is not great! I will try to adjust my site to match.

Offline

 

#5 2021-02-11 15:11:40

TOnin
Member
1970-01-01
106

Re: How can I create and display an image Property?

Please, have a look at Manage Properties Photos plugin https://piwigo.org/ext/extension_view.php?eid=783
You will be able to create fields according to your wishes.

Offline

 

Board footer

Powered by FluxBB

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