Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Clickable and Searchable image description Custom field  (Read 3396 times)

0 Members and 1 Guest are viewing this topic.

MadMaxx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Clickable and Searchable image description Custom field
« on: July 24, 2008, 11:05:40 pm »

hi

I added an image description custom field named 'Artist', in thumbnail view and in intermediate view (pic1 and pic2)
i'd like to be able to click on that name and do a search of all pics created by that artist.

i did a search and found this old article http://forum.coppermine-gallery.net/index.php/topic,3396.msg14936.html#msg14936
but it didn't work, probably made for an earlier version.

any help would be really appreciated, thank you.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

MadMaxx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: Clickable and Searchable image description Custom field
« Reply #2 on: July 27, 2008, 10:51:50 pm »

Thank you for your quick answer , but that's not what i was looking for.
That only works if you use bbcode, in this case the user enters the artist's name only (no bbcode)
and clicking the name would search the gallery for all images created by that artist.

I found a way and it seems to work:

first i used this info provided by nibbler here: http://forum.coppermine-gallery.net/index.php/topic,38804.0.html
to make the custom field a default search field.

then for the intermediate view (pic2) i changed the code in displayimage.php
from
Code: [Select]
for ($i = 1; $i <= 4; $i++) {
        if ($CONFIG['user_field' . $i . '_name']) {
            if ($CURRENT_PIC_DATA['user' . $i] != "") {
                $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]);
}else{
    $info[$CONFIG['user_field' . $i . '_name']] ='Unknown';
            }
        }
to
Code: [Select]
for ($i = 1; $i <= 4; $i++) {
        if ($CONFIG['user_field' . $i . '_name']) {
            if ($CURRENT_PIC_DATA['user' . $i] != "") {
$info[$CONFIG['user_field' . $i . '_name']] = '<a href ="thumbnails.php?album=search&search='.$CURRENT_PIC_DATA['user' . $i].'">'.$CURRENT_PIC_DATA['user' . $i].'</a>';
}else{
    $info[$CONFIG['user_field' . $i . '_name']] ='Unknown';
            }
        }

for the thumbnail view (pic1) i used the code provided by stramm here: http://forum.coppermine-gallery.net/index.php/topic,27654.0.html
to add a custom field to the thumbnail view, and changed the code
from
Code: [Select]
if ($row['user1']) {
           $user1_temp = $row['user1'];
        } else {
           $user1_temp = 'Unknown';
        }
$caption .= '<span style="font-weight:bold;">'."Artist: ".'</span>'.'<span style="color:red;font-weight:bold;">'.$user1_temp.'<br /></span>';
to
Code: [Select]
if ($row['user1']) {
           $user1_temp = $row['user1'];
        } else {
           $user1_temp = 'Unknown';
        }
$caption .= '<span style="font-weight:bold;">'."Artist: ".'</span>'.'<span style="color:red;font-weight:bold;"><a href ="thumbnails.php?album=search&search='.$user1_temp.'">'.$user1_temp.'</a><br /></span>';
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.