Showing uploader name when editing images Showing uploader name when editing images
 

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

Showing uploader name when editing images

Started by 406man, August 16, 2023, 12:58:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

406man

Could I put in a little request to the developers for a minor change to the code in editpics.php in a future release.  This is used in several different places to display images in an album for editing and allow changes to be made. Many pieces of image information are shown but the name of the uploader is only shown when the routine is used for upload approval by an administrator. It's not shown when images are shown for editing by the administrator. It seems odd to display file size, pixel dimensions and file name when editing file information but not who uploaded it – which can be quite important. To clarify, I'm asking for the uploader name to always be displayed instead of only when images are approved. 

I've looked at ways to implement this with a plugin and although it could be done in theory it's unnecessarily complicated in practice (rewriting the html after the page has been created but before being written to the web browser). A change to the base code would be a lot simpler and I can't think of any downsides. Any suggestions welcome if I've overlooked a potential solution as I'm happy to write a plugin to implement it.

The code change to implement this in editpics.php is shown in the extract below. Just delete the two highlighted lines.  An attached screenshot shows where the uploader name would be displayed.

Thanks in advance

[editpics.php Line 385]
function form_pic_info($text)
{
    global $CURRENT_PIC, $THUMB_ROWSPAN, $CONFIG;
    global $lang_byte_units, $lang_editpics_php, $lang_common, $loop_counter, $row_style_class, $icon_array, $cpg_udb;

    if (!is_movie($CURRENT_PIC['filename'])) {
        $pic_info = sprintf($lang_editpics_php['pic_info_str'], $CURRENT_PIC['pwidth'], $CURRENT_PIC['pheight'], ($CURRENT_PIC['filesize'] >> 10), $CURRENT_PIC['hits'], $CURRENT_PIC['votes']);
    } else {
        $pic_info = sprintf($lang_editpics_php['pic_info_str'], '<input type="text" name="pwidth'.$CURRENT_PIC['pid'].'" value="'.$CURRENT_PIC['pwidth'].'" size="5" maxlength="5" class="textinput" />',
              '<input type="text" name="pheight'.$CURRENT_PIC['pid'].'" value="'.$CURRENT_PIC['pheight'].'" size="5" maxlength="5" class="textinput" />', ($CURRENT_PIC['filesize'] >> 10),
              $CURRENT_PIC['hits'], $CURRENT_PIC['votes']);
    }

    if (UPLOAD_APPROVAL_MODE) {                    <<<<<< DELETE LINE
        if ($CURRENT_PIC['owner_id']) {
            $pic_info .= ' - <a href="profile.php?uid=' . $CURRENT_PIC['owner_id'] . '">' . $cpg_udb->get_user_name($CURRENT_PIC['owner_id']) . '</a>';
        }
    }                                               <<<<<< DELETE LINE

    $thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
    $thumb_link = 'displayimage.php?pid='.$CURRENT_PIC['pid'];
[/size]