Here's how I've put the code and my first part of the section looks like:
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
$thumb = mysql_fetch_assoc(cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} ORDER BY pid DESC LIMIT 1"));
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $CURRENT_ALBUM_DATA['aid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];