Customize HTML (visual) displayimage.php Customize HTML (visual) displayimage.php
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Customize HTML (visual) displayimage.php

Started by Hanna., January 09, 2018, 06:14:25 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Hanna.

Hi! I need to add some manual HTML into the displayimage.php page (ex. https://kristincavallari.net/gallery/displayimage.php?album=343&pid=20729#top_display_media)

Need reference of where to make customizations to above, and below the normal_ image.

ron4mac

Copy the $template_display_media section from include/themes.inc.php (lines 853-904) into your theme.php file.
Make your modifications to it there.

Hanna.

Tried to put this in, but no luck, just error message saying "Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /home/minowncu/public_html/addons/kristincavallari.net/gallery/themes/feb2018/theme.php on line 279"

/******************************************************************************
** Section <<<$template_display_media>>> - START
******************************************************************************/
// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table width="100%" cellspacing="2" cellpadding="0">
                                <tr>
                                        <td align="center" style="{SLIDESHOW_STYLE}">
                                               
<span><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- big responsive1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-3745573792438232"
     data-ad-slot="2050586508"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></span>

{IMAGE}
                                        </td>
                                </tr>
                        </table>
                </td>
            </tr>
            <tr>
                <td>
                        <table width="100%" cellspacing="2" cellpadding="0" class="tableb tableb_alternate">
                                        <tr>
                                                <td align="center">
                                                        {ADMIN_MENU}
                                                </td>
                                        </tr>
                        </table>


<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb tableb_alternate" width="100%">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb tableb_alternate"><h1 class="pic_title">
                                                {TITLE}
                                        </h1></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb tableb_alternate"><h2 class="pic_caption">
                                                {CAPTION}
                                        </h2></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
        </tr>

EOT;

ron4mac

You missed a few lines at the bottom:
/******************************************************************************
** Section <<<$template_display_media>>> - END
******************************************************************************/
} //{THEMES}

Hanna.

Quote from: ron4mac on February 05, 2018, 02:31:39 AM
You missed a few lines at the bottom:
/******************************************************************************
** Section <<<$template_display_media>>> - END
******************************************************************************/
} //{THEMES}


Leaves blank page... https://kristincavallari.net/gallery/displayimage.php?album=445&pid=27226

Hanna.

Quote from: Hanna. on February 05, 2018, 05:24:36 PM
Leaves blank page... https://kristincavallari.net/gallery/displayimage.php?album=445&pid=27226

This is my theme.php:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2011 Coppermine Dev Team
  v1.0 originally written by Gregory Demar

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.5.12
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/themes/water_drop/theme.php $
  $Revision: 8154 $
**********************************************/

define('THEME_HAS_PROGRESS_GRAPHICS'1);

/******************************************************************************
** Section <<<$template_display_media>>> - START
******************************************************************************/
// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table width="100%" cellspacing="2" cellpadding="0">
                                <tr>
                                        <td align="center" style="{SLIDESHOW_STYLE}">
                                               
<span>xxx</span>

{IMAGE}
                                        </td>
                                </tr>
                        </table>
                </td>
            </tr>
            <tr>
                <td>
                        <table width="100%" cellspacing="2" cellpadding="0" class="tableb tableb_alternate">
                                        <tr>
                                                <td align="center">
                                                        {ADMIN_MENU}
                                                </td>
                                        </tr>
                        </table>


<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb tableb_alternate" width="100%">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb tableb_alternate"><h1 class="pic_title">
                                                {TITLE}
                                        </h1></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb tableb_alternate"><h2 class="pic_caption">
                                                {CAPTION}
                                        </h2></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
        </tr>

EOT;

/******************************************************************************
** Section <<<$template_display_media>>> - END
******************************************************************************/
//{THEMES}


/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - START
******************************************************************************/
// Display the full size image
function theme_display_fullsize_pic()
{
    global 
$CONFIG$THEME_DIR$FORBIDDEN_SET$LINEBREAK$pid;
    global 
$lang_errors$lang_fullsize_popup$lang_charset;

    
$superCage Inspekt::makeSuperCage();

    if (!
USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
        
printf($lang_errors['login_needed'],'','','','');
        die();
    } elseif (
USER_ID && USER_ACCESS_LEVEL <= 2) {
        
printf($lang_errors['access_intermediate_only'],'','','','');
        die();
    }
    if (
$superCage->get->keyExists('picfile')) {
        if (!
GALLERY_ADMIN_MODE) {
            
cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
        }
        
//$picfile = $_GET['picfile'];
        //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities
        
$matches $superCage->get->getMatched('picfile''/^[0-9A-Za-z\/_.-]+$/');
        
$picfile $matches[0];
        
$picname $CONFIG['fullpath'] . $picfile;
        
$imagesize = @getimagesize($picname);
        
$imagedata = array('name' => $picfile'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif (
$pid) {
        
$sql "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " "WHERE pid='$pid$FORBIDDEN_SET";
        
$result cpg_db_query($sql);
        if (!
cpg_db_num_rows($result)) {
            
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
        }
        
$row cpg_db_fetch_assoc($result);
        if (
is_image($row['filename'])) {
            
$pic_url get_pic_url($row'fullsize');
            
$geom 'width="' $row['pwidth'] . '" height="' $row['pheight'] . '"';
            
$imagedata = array('name' => $row['filename'], 'path' => $pic_url'geometry' => $geom);
        } else {
            
$pic_html theme_html_picture();
            if (
is_movie($row['filename'])) {
                
$mime_content cpg_get_type($row['filename']);
                
$ctrl_offset['mov']=15;
                
$ctrl_offset['wmv']=45;
                
$ctrl_offset['swf']=0;
                
$ctrl_offset['rm']=0;
                
$ctrl_offset_default=45;
                
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
                
preg_match('/width="([0-9]+)".*height="([0-9]+)"/'$pic_html$matches);
                
$width $matches[1] + $CONFIG['fullsize_padding_x'];
                
$height $matches[2] + $CONFIG['fullsize_padding_y']+ $ctrl_height;
                
$resize_window '<script type="text/javascript">window.resizeTo('.$width.', '.$height.')</script>';
            }
            
preg_match('/<td align="center" style="{SLIDESHOW_STYLE}">.*(.*)<\/td>/Us'$pic_html$matches);
            
$pic_html $matches[1].$resize_window;
        }
    }
    if ((!
USER_ID && $CONFIG['allow_unlogged_access'] <= 2) || (USER_ID && USER_ACCESS_LEVEL <= 2)) {
        
// adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message
        
$row['pwidth'] = 200;
        
$row['pheight'] = 100;
    }

    
$charset = ($CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset']);
    
$fullsize_html = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=
$charset" />
        <title>
{$CONFIG['gallery_name']}{$lang_fullsize_popup['click_to_close']}</title>
        <style type="text/css">
            body { margin: 0; padding: 0; background-color: gray; }
            img { margin:0; padding:0; border:0; }
            #content { margin:0 auto; padding:0; border:0; }
            table { border:0; width:
{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse}
            td { vertical-align: middle; text-align:center; }
        </style>

        <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script>
        <script type="text/javascript" src="js/displayimage.fullsize.js"></script>
    </head>
    <body style="margin:0px; padding:0px; background-color: gray;">
<div style="border:1px solid black;">

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins style="display:block;"
     data-ad-format="rectangle; height:auto;"
     data-ad-client="ca-pub-3745573792438232;"
     data-ad-slot="3524004162;"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

</div>
EOT;
    if (
$pic_html) {
        
$fullsize_html .= $pic_html;
    } else {
        if (
$CONFIG['transparent_overlay'] == 1) {
            
$fullsize_html .= <<<EOT
            <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;">
                <tr>

EOT;
            
$fullsize_html .=  '<td align="center" valign="middle" background="' htmlspecialchars($imagedata['path']) . '" ' $imagedata['geometry'] . ' class="image">';
            
$fullsize_html .=  '<div id="content">';
            
$fullsize_html .=  '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id='
                    
floor(rand()*1000+rand())
                    . 
'&amp;fullsize=yes" '
                    
$imagedata['geometry']
                    . 
' alt="'
                    
htmlspecialchars($imagedata['name'])
                    . 
'" title="'
                    
htmlspecialchars($imagedata['name'])
                    . 
$LINEBREAK $lang_fullsize_popup['click_to_close']
                    . 
'" /></a><br />' $LINEBREAK;
            
$fullsize_html .=  <<<EOT
                        


</div>
                    </td>
                </tr>
            </table>

EOT;
        } else {
            
$fullsize_html .=  '        <div id="content">'.$LINEBREAK;
            
$fullsize_html .=  '<a href="javascript: window.close()"><img src="'
            
htmlspecialchars($imagedata['path']) . '" '
            
$imagedata['geometry']
            . 
' id="fullsize_image" alt="'
            
htmlspecialchars($imagedata['name'])
            . 
'" title="'
            
htmlspecialchars($imagedata['name'])
            . 
$LINEBREAK $lang_fullsize_popup['click_to_close']
            . 
'" /></a><br />' $LINEBREAK
            
'        </div>'.$LINEBREAK;
        }
    }
    
$fullsize_html .= <<<EOT

  </body>
</html>

EOT;

    
$fullsize_html CPGPluginAPI::filter('fullsize_html'$fullsize_html);
    echo 
$fullsize_html
}
/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - END
************************************************************************************/

/******************************************************************************
** Section <<<$template_cat_list>>> - START
******************************************************************************/
// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="100%" align="left">{CATEGORY}</td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="catrow_noalb" colspan="3"><table border="0" style="vertical-align: top;"><tr><td style="vertical-align: top;">{CAT_THUMB}</td><td align="left"><div class="catlink-big">{CAT_TITLE} &nbsp; <small>&#38;#38;#10093;</small> </div>{CAT_DESC}</td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><table border="0" style="vertical-align: top;"><tr><td style="vertical-align: top;">{CAT_THUMB}</td><td><div class="catlink-big">{CAT_TITLE} &nbsp; <small>&#38;#38;#10093;</small> </div> {CAT_DESC}</td></tr></table></td>
        </tr>
        <tr>
            <td class="tableb tableb_alternate" colspan="3">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
/******************************************************************************
** Section <<<$template_cat_list>>> - END
******************************************************************************/

ron4mac

The link above displays okay for me ...
But, attached, is what your theme.php file should be.
There was an extra brace ( } ) ... probably my fault.

Hanna.

Quote from: ron4mac on February 05, 2018, 06:35:20 PM
The link above displays okay for me ...
But, attached, is what your theme.php file should be.
There was an extra brace ( } ) ... probably my fault.

Wow! Thank you!