Editing Displayed File Information Editing Displayed File Information
 

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

Editing Displayed File Information

Started by mike_control, October 27, 2004, 03:41:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mike_control

Hi.

I'm wondering if I could completely remove certain fields from the file information.
These fields are:

Filename.
Album Name.
Keywords.
File Size.
Dimensions.
Displayed.
Favorites.

Basically, everything besides my custom fields and url :)

Any help would be appreciated greatly.

Thanks.

Fake Edit: Oh, before I forget, I'm also wondering if I could remove comment_count and hit_count being displayed in index.php

Joachim Müller

take a look into displayimage.php (use a plain text editor), find // Display picture information
function html_picinfo()
and edit the code after it to accomplish what you're looking for (this is the place where all the file information is gathered). Comment out the lines that compose something like $info['foobar'] =... to get rid of the line with foobar information.

Joachim

P.S. We have a "one question per thread" policy...

stereo

still dealing with the picinfo editing thing... can't find a way to comment out or delete any of the pic data. Keep having errors. For example removing the filename and it's complete tablecells. Can you be any more specific? thanks.
jeroen

Casper

To remove the filename, all you need to do is change this line of code;
$info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);

To this;
//$info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);

And the other lines can be similarly removed, i.e, to remove the favorites, this code;
$info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . "\">" . $lang_picinfo['addFav'] . '</a>';
    } else {
       $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . "\">" . $lang_picinfo['remFav'] . '</a>';
    }


Needs to be changed to this;
//  $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . "\">" . $lang_picinfo['addFav'] . '</a>';
    } else {
       // $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . "\">" . $lang_picinfo['remFav'] . '</a>';
    }
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

stereo

Feel silly to have used the wrong uncomment characters ... and it's so easy. thanks a lot.

peter_g


i am a newbie to php (more windows, c# experience) and am helping out someone hosting a site with coppermine.  i commented out some code for displaying file info in displayimage.php

i've done that...  and saved it on the server.   is there anything else i need to do for it take effect.   i dont see the change on the web site.

any help... pls

peter

Joachim Müller

without knowing what you actually changed and a link to the page you're refering to it's hard to tell what goes wrong. Maybe the old page content is still cached in your browser? Have you tried force-refreshing the page ([Ctrl]+[F5])?

peter_g

hi gaugau

thanks for replying.      here's a snippet of displayimage.php ...   the complete "main" section of code with the change i made (search for 
"//  hide picture info - peter")

but here's the 1 line i commented out from "main"   t

  //  hide picture info - peter
  //  $pic_info = html_picinfo();
      $pic_info = '';


however the real problem is, and this is the better fix, is that
the admin config option to hide picture information  by default is not working (on our server anyway).  ie, whether set to yes/no it still displays the file information for photos by default ("file information is visible by default")

your help is appreciated!

peter
-----------------------------------------------------------------

/**
* Main code
*/

$pos = isset($HTTP_GET_VARS['pos']) ? (int)$HTTP_GET_VARS['pos'] : 0;
$cat = isset($HTTP_GET_VARS['cat']) ? (int)$HTTP_GET_VARS['cat'] : 0;
$album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : '';
// Build the album set if required
if (!is_numeric($album) && $cat) { // Meta albums, we need to restrict the albums to the current category
    if ($cat < 0) {
        $ALBUM_SET .= 'AND aid IN (' . (- $cat) . ') ';
    } else {
        $ALBUM_SET_ARRAY = array();
        if ($cat == USER_GAL_CAT)
            $where = 'category > ' . FIRST_USER_CAT;
        else
            $where = "category = '$cat'";

        $result = db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE $where");
        while ($row = mysql_fetch_array($result)) {
            $ALBUM_SET_ARRAY[] = $row['aid'];
        } // while
        get_subcat_data($cat, $CONFIG['subcat_level']);
        // Treat the album set
        if (count($ALBUM_SET_ARRAY)) {
            $set = '';
            foreach ($ALBUM_SET_ARRAY as $album_id) $set .= ($set == '') ? $album_id : ',' . $album_id;
            $ALBUM_SET .= "AND aid IN ($set) ";
        }
    }
}
// Retrieve data for the current picture
if ($pos < 0) {
    $pid = - $pos;
    $result = db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");
    if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $row = mysql_fetch_array($result);
    $album = $row['aid'];
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++);
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];
} elseif (isset($HTTP_GET_VARS['pos'])) {
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    if ($pic_count == 0) {
        cpg_die(INFORMATION, $lang_errors['no_img_to_display'], __FILE__, __LINE__);
    } elseif (count($pic_data) == 0 && $pos >= $pic_count) {
        $pos = $pic_count - 1;
        $human_pos = $pos + 1;
        $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    }
    $CURRENT_PIC_DATA = $pic_data[0];
}
// Retrieve data for the current album
if (isset($CURRENT_PIC_DATA)) {
    $result = db_query("SELECT title, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1");
    if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__);
    $CURRENT_ALBUM_DATA = mysql_fetch_array($result);

    if (is_numeric($album)) {
        $cat = - $album;
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
        $cat = - $album;
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
    }
}

if (isset($HTTP_GET_VARS['fullsize'])) {
    display_fullsize_pic();
    ob_end_flush();
} elseif (isset($HTTP_GET_VARS['slideshow'])) {
    slideshow();
    ob_end_flush();
} else {
    if (!isset($HTTP_GET_VARS['pos'])) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $picture_title = $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_", " ");

    $nav_menu = html_img_nav_menu();
    $picture = html_picture();
    $votes = html_rating_box();

//  hide picture info - peter
//  $pic_info = html_picinfo();
      $pic_info = '';

    $comments = html_comments($CURRENT_PIC_DATA['pid']);
    if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = ""; }

    pageheader($album_name . '/' . $picture_title, $meta_keywords, false);
    // Display Breadcrumbs
    if ($breadcrumb && !(strpos($CONFIG['main_page_layout'],"breadcrumb")===false)) {
        theme_display_breadcrumb($breadcrumb, $cat_data);
    }
    // Display Filmstrip if the album is not search
    if ($album != 'search') {
        $film_strip = display_film_strip($album, (isset($cat) ? $cat : 0), $pos, true);
    }
    theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);
    pagefooter();
    ob_end_flush();
}

Nibbler


peter_g

#9
it's filika

thanks...