Clickable and Searchable image description Custom field Clickable and Searchable image description Custom field
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Clickable and Searchable image description Custom field

Started by MadMaxx, July 24, 2008, 11:05:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MadMaxx

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.


MadMaxx

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
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
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
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
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>';