Dispaly User Fields Under Thumb and Intermediate Image Dispaly User Fields Under Thumb and Intermediate Image
 

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

Dispaly User Fields Under Thumb and Intermediate Image

Started by COS@RIN, October 28, 2005, 10:20:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

COS@RIN

I know someone out there will have the answer to this.

I have search for the answer to my question but am having difficulty in finding it. I hope someone can point me to a topic that answers my question or answer it for me, and thank you in advance.

Right my question sounds so simple, but I cant quite grasp it as I am a realtively newbie to all that is php.

I am looking to be able to show the contents of User1 and User2 fileds under both the thumbnail and intermeidate images. However I dont want to have to show all the information as set by the "show file information by default" setting.

Can someone show me how to do this in the most simplest method possible.

Thanks again.

COSARIN

COS@RIN

Well I have sorted one of these out.

In case anyone else is interested. To display the results of a custom user field on the intermediate view pages (disaplyimage.php) the solution is quite simple.

The first step is to define a parameter and place holder for the value.

This can be done by editting the displayimage.php file with the following.

find:

$params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $pic_html,
        '{ADMIN_MENU}' => $picture_menu,
        '{TITLE}' => $CURRENT_PIC_DATA['title'],
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

    return template_eval($template_display_picture, $params);
}


and add into the parameter list something like.


        '{USER1}' => $CURRENT_PIC_DATA['user1'],


Change the USER1 and user1 parts with USER2 / USER3 depending on the field you wish to show.

Then in your theme.php find the area that defines the html for the intermediate picture display, and add above or below your image the following.


{USER1}


or USER2 / USER3 depending on the user field you wish to show.

However I am still having difficulty with putting the same information into the thumbnail view. Its does not look as simple as with the intermediate image page.

Can anyone help me?

COSARIN

Stramm

it's even easier. In functions.inc.php find the function get_pic_data(), the $caption variable holds what's getting displayed in thumb view under the thumbs. If you edit $caption below // Regular albums then the main thumb view gets changed.. to change the meta albums display you have to eg. modify $caption under case 'lastcom':

COS@RIN

I can see that the area you mentioned gives the caption information, but which part do I change and how do I get it to call the data in User1 customer field. Each section seems to have its own function like comments, or rating, or picture owner. Where do I add the different data or what do I change.

The code I have is



                // Set picture caption
                if ($set_caption) foreach ($rowset as $key => $row){

                        $caption = "<span class=\"thumb_title\">";
                        $caption .= ($rowset[$key]['title']||$rowset[$key]['hits']) ? $rowset[$key]['title'] : '';

            if ($CONFIG['views_in_thumbview']){
               if ($rowset[$key]['title']){$caption .= "&nbsp;&ndash;&nbsp;";}
            $caption .= sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits']);
            }
                 $caption .= "</span>";


                        if ($CONFIG['caption_in_thumbview']){
                           $caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">".bb_decode(($rowset[$key]['caption']))."</span>" : '';
                        }
                        if ($CONFIG['display_comment_count']) {
                                $comments_nr = count_pic_comments($row['pid']);
                                if ($comments_nr > 0) $caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $comments_nr )."</span>";
                        }

                        if ($CONFIG['display_uploader']){
                                $caption .= '<span class="thumb_title"><a href ="profile.php?uid='.$rowset[$key]['owner_id'].'">'.$rowset[$key]['owner_name'].'</a></span>';
                        }

                        $rowset[$key]['caption_text'] = $caption;

                }

                return $rowset;
        }


I hope you can help.

COSARIN

Stramm

you still are looking for help with it or is it already solved?

COS@RIN

Stramm

Yes I am still looking for help on this.

I solved the "display custom user fileds below the image in intermediate view" in displayimage.php

But I still need help on displaying user fileds under each thumbnail image in the thumbnails.php

I hope you can help.

Thanks

COSARIN

COS@RIN

Quote from: Stramm on October 29, 2005, 02:01:46 PM
it's even easier. In functions.inc.php find the function get_pic_data(), the $caption variable holds what's getting displayed in thumb view under the thumbs. If you edit $caption below // Regular albums then the main thumb view gets changed.. to change the meta albums display you have to eg. modify $caption under case 'lastcom':

Please explain how I adjust the information without altering the default systems.

In other words I dont want to have to click show comments in the config menu to show a user field.

Thanks

COSARIN

Stramm

sorry, wasn't online for a few days.. and I've not tested what I'm telling you now

a few lines above // Set picture caption (from your code) find
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';
add to it your user1 and user2 columns. Then scroll down a few lines and find
                        $rowset[$key]['caption_text'] = $caption;
above add
$caption = "<span class=\"thumb_caption\">User 1: ".$row['user1'])." - User 2:".$row['user2'])."'</span>';



COS@RIN

Stramm

Thanks for your help.

You code has been tried and tested and with slight changes works a treat.

I noticed that your code shown below needed slight alteration, as it displayed both user1 and user2 data, but left out the Title.

Quote$caption = "<span class=\"thumb_caption\">User 1: ".$row['user1'])." - User 2:".$row['user2'])."'</span>';

So I slightly changed it to suit my needs to

$caption = '<span><tr><td class="pictitle2">'.$row['title'].'</td></tr><tr><td class="latinname2">(Latin Name: '.$row['user1'].')</td></tr></span>';

and this then worked perfectly for my requirements.

First showing the Title, then Latin Name which is stored in the User1 custom field.

Thanks very much for your assistace.

COS@RIN