News:

CPG Release 1.6.31
Minor maintenance release
Clean up remaining remnants of the .net CPG website
Improved installer_stub compatibility with various server configurations

Main Menu

"Click image to view full size"

Started by fran86, May 16, 2015, 12:32:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fran86

I am having trouble with this "Click image to view full size" under the intermediate photos.

Found this thread: http://coppermine-gallery.com/forum/index.php?topic=75299.0 then it led me to the documentation: http://documentation.coppermine-gallery.net/en/theme_theme_php.htm#theme_create_theme_display_image - can't figure out where to put the line of code in theme.php, I keep getting a parse error.

function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)

My current theme.php looks like:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 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 as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.8
  $Source$
  $Revision: 3116 $
  $Author: gaugau $
  $Date: 2006-06-08 00:11:54 +0200 (Do, 08 Jun 2006) $
**********************************************/

define('THEME_IS_XHTML10_TRANSITIONAL',1);
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_HAS_FILM_STRIP_GRAPHIC', 1);
define('THEME_HAS_RATING_GRAPHICS', 1);                                           

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='.';

// HTML template for the image navigation bar
$template_img_navbar = <<<EOT

        <tr>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="{LOCATION}images/thumbnails.gif" valign="middle" border="0px" alt="{THUMB_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="javascript:;" class="navmenu_pic" onclick="blocking('picinfo','yes', 'block'); return false;" title="{PIC_INFO_TITLE}"><img src="{LOCATION}images/info.gif" border="0px" align="middle" alt="{PIC_INFO_TITLE}" /></a>
                </td>

                                <td align="center" valign="middle" class="navmenu" width="48">
                                                        <a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/prev.gif"  border="0px" align="middle" alt="{PREV_TITLE}" /></a>
                </td>





                <td align="center" valign="middle" class="navmenu" width="100%">
                        {PIC_POS}
                </td>


                                <td align="center" valign="middle" class="navmenu" width="48">
                                                        <a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/next.gif"  border="0px" align="middle" alt="{NEXT_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0px" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
                </td>
<!-- BEGIN report_file_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{REPORT_TGT}" class="navmenu_pic" title="{REPORT_TITLE}"><img src="{LOCATION}images/report.gif" border="0" align="middle" alt="{REPORT_TITLE}" /></a>
                </td>
<!-- END report_file_button -->
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0px" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->


        </tr>

EOT;


/******************************************************************************
** Section <<<theme_display_thumbnails>>> - START
******************************************************************************/
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date='')
{
    global 
$CONFIG, $CURRENT_ALBUM_DATA;
    global 
$template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors;

    
$superCage = Inspekt::makeSuperCage();

    static 
$header = '';
    static 
$thumb_cell = '';
    static 
$empty_cell = '';
    static 
$row_separator = '';
    static 
$footer = '';
    static 
$tabs = '';
    static 
$spacer = '';

    if (
$header == '') {
        
$thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        
$tabs = template_extract_block($template_thumbnail_view, 'tabs');
        
$header = template_extract_block($template_thumbnail_view, 'header');
        
$empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        
$row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        
$footer = template_extract_block($template_thumbnail_view, 'footer');
        
$spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }

    
$cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    
$date_link = $date=='' ? '' : '&amp;date=' . $date;
    if (
$superCage->get->getInt('uid')) {
      
$uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
    } else {
      
$uid_link = '';
    }

    
$album_types = array(
        
'albums' => array('lastalb')
    );
    
$album_types = CPGPluginAPI::filter('theme_thumbnails_album_types', $album_types);

    
$theme_thumb_tab_tmpl = $template_tab_display;

    if (
$mode == 'thumb') {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => in_array($aid, $album_types['albums']) ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        
$theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&amp;page=%d'));
    } else {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        
$theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }

    
$thumbcols = $CONFIG['thumbcols'];
    
$cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';

    
$tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';

    if (!
GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) {
        
template_extract_block($template_thumb_view_title_row, 'admin_buttons');
    }
    
// The sort order options are not available for meta albums
    
if ($sort_options) {
        if (
GALLERY_ADMIN_MODE) {
            
$param = array(
                
'{ALBUM_ID}'   => $aid,
                
'{CAT_ID}'     => ($cat > 0 ? $cat : $CURRENT_ALBUM_DATA['category']),
                
'{MODIFY_LNK}'     => $lang_common['album_properties'],
                
'{MODIFY_ICO}'     => cpg_fetch_icon('modifyalb', 1),
                
'{PARENT_CAT_LNK}' => $lang_common['parent_category'],
                
'{PARENT_CAT_ICO}' => cpg_fetch_icon('category', 1),
                
'{EDIT_PICS_LNK}'  => $lang_common['edit_files'],
                
'{EDIT_PICS_ICO}'  => cpg_fetch_icon('edit', 1),
                
'{ALBUM_MGR_LNK}'  => $lang_common['album_manager'],
                
'{ALBUM_MGR_ICO}'  => cpg_fetch_icon('alb_mgr', 1),
            );
        } else {
            
$param = array();
        }
        
$param['{ALBUM_NAME}'] = $album_name;
        
// Plugin Filter: allow plugin to modify or add tags to process
        
$param = CPGPluginAPI::filter('theme_thumbnails_title', $param);
        
$title = template_eval($template_thumb_view_title_row, $param);
    } elseif (
USER_ID && $aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) { //Lots of stuff can be added here later
        
$param = array(
            
'{ALBUM_ID}'   => $aid,
            
'{ALBUM_NAME}' => $album_name,
            
'{DOWNLOAD_ZIP}' => cpg_fetch_icon ('zip', 2) . $lang_thumb_view['download_zip'],
        );
        
// Plugin Filter: allow plugin to modify or add tags to process
        
$param = CPGPluginAPI::filter('theme_thumbnails_title', $param);       
        
$title = template_eval($template_fav_thumb_view_title_row, $param);
    } else {
        
$title = $album_name;
    }

    
CPGPluginAPI::action('theme_thumbnails_wrapper_start', null);

    if (
$mode == 'thumb') {
        
starttable('100%', $title, $thumbcols);
    } else {
        
starttable('100%');
    }

    echo 
$header;

    
$i = 0;
    global 
$thumb;  // make $thumb accessible to plugins
    
foreach($thumb_list as $thumb) {
        
$i++;
        if (
$mode == 'thumb') {
            if (
in_array($aid, $album_types['albums'])) {
                
$params = array(
                    
'{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    
'{THUMB}'      => $thumb['image'],
                    
'{CAPTION}'    => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            } else {
                
// determine if thumbnail link targets should open in a pop-up
                
if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
                    
if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                       
$target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
                    } elseif (
USER_ID && USER_ACCESS_LEVEL <= 2) {
                        
$target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
                    } else {
                       
$target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
                    }
                } elseif (
$aid == 'random') {
                    
$target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
                } elseif (
$aid == 'lastcom' || $aid == 'lastcomby') {
                    
$page = cpg_get_comment_page_number($thumb['msg_id']);
                    
$page = (is_numeric($page)) ? "&amp;page=$page" : '';
                    
$target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                } else {
                    
$target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
                }
                
$params = array(
                    
'{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}'   => $target,
                    
'{THUMB}'      => $thumb['image'],
                    
'{CAPTION}'    => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            }

        } else {  
// mode != 'thumb'

            // Used for mode = 'user' from list_users() in index.php
            
$params = array(
                
'{CELL_WIDTH}' => $cell_width,
                
'{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
                
'{THUMB}'      => $thumb['image'],
                
'{CAPTION}'    => $thumb['caption'],
                
'{ADMIN_MENU}' => '',
            );

        }

        
// Plugin Filter: allow plugin to modify or add tags to process
        
$params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params);
        echo 
template_eval($thumb_cell, $params);

        if (((
$i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo 
$row_separator;
        }
    } 
// foreach $thumb

    
unset($thumb);  // unset $thumb to avoid conflicting with global

    
for (;($i % $thumbcols); $i++) {
        echo 
$empty_cell;
    }
    
$footer = CPGPluginAPI::filter('theme_thumbnails_footer', $footer);
    echo 
$footer;

    if (
$display_tabs) {
        
$params = array(
            
'{THUMB_COLS}' => $thumbcols,
            
'{TABS}'       => $tabs_html,
        );
        echo 
template_eval($tabs, $params);
    }

    
endtable();
    
CPGPluginAPI::action('theme_thumbnails_wrapper_end', null);
    echo 
$spacer;
}
/******************************************************************************
** Section <<<theme_display_thumbnails>>> - END
******************************************************************************/
?>

fran86

Sorry, my correct theme.php:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2012 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.18
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/themes/water_drop/theme.php $
  $Revision: 8304 $
**********************************************/

define('THEME_HAS_PROGRESS_GRAPHICS', 1);

// HTML template for template sys_menu spacer
$template_sys_menu_spacer = '&middot;';

?>

allvip

#2
All functions can be found in themes/sample/theme.php. Everytime you need to change something just copy the function you need in themes/your_theme_name/theme.php.

You can use function $template_display_media:


/******************************************************************************
** 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}">
                                                {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
******************************************************************************/



Paste the above code to themes/your_theme_name/theme.php and add under token {IMAGE} (or {CAPTION} or {TITLE} depends or you want it):

<p align="right">Click image to view full size<p>

Add to your themes/your_theme_name/your_style.css:


.display_media .image {
    cursor: zoom-in;
    cursor:-webkit-zoom-in;
}


CSS cursor Property http://www.w3schools.com/cssref/pr_class_cursor.asp

I think the zoom property does not work in all the browsers;

allvip

#3
Quote from: fran86 on May 16, 2015, 12:32:22 PM
it led me to the documentation: http://documentation.coppermine-gallery.net/en/theme_theme_php.htm#theme_create_theme_display_image - can't figure out where to put the line of code in theme.php, I keep getting a parse error.

function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)

That talks about function theme_display_image. It tells you to copy the function to your theme.php not the name of the function.


/******************************************************************************
** Section <<<theme_display_image>>> - START
******************************************************************************/
function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)
{
    global $CONFIG, $LINEBREAK;

    $superCage = Inspekt::makeSuperCage();

    $width = $CONFIG['picture_table_width'];

    echo '<a name="top_display_media"></a>'; // set the navbar-anchor
    starttable();
    echo $nav_menu;
    endtable();

    starttable();
    echo $picture;
    endtable();
    if ($CONFIG['display_film_strip'] == 1) {
        echo $film_strip;
    }


    echo $votes;

    $picinfo = $superCage->cookie->keyExists('picinfo') ? $superCage->cookie->getAlpha('picinfo') : ($CONFIG['display_pic_info'] ? 'block' : 'none');
    echo $LINEBREAK . '<div id="picinfo" style="display: '.$picinfo.';">' . $LINEBREAK;
    starttable();
    echo $pic_info;
    endtable();
    echo '</div>' . $LINEBREAK;

    echo '<a name="comments_top"></a>';
    echo '<div id="comments">' . $LINEBREAK;
        echo $comments;
        echo '</div>' . $LINEBREAK;

}
/******************************************************************************
** Section <<<theme_display_image>>> - END
******************************************************************************/



I think is better to use function $template_display_media, but you can use even this one. Add under


    starttable();
    echo $picture;
    endtable();



    starttable();
    echo '<p align="right">Click image to view full size<p>';
    endtable();

fran86

Thank you very much :) I will mark this as solved!

allvip

Similar: Images to fit screen resolution plugin ( responsive image plugin ) Use full-sized pictures on the intermediate-sized pictures pages and downscale them if needed to fit the users screen resolution. A click on the picture scales it to full original size http://coppermine-gallery.com/forum/index.php/topic,77586.0.html