Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Closed]: Download link on displayimage.php  (Read 20354 times)

0 Members and 1 Guest are viewing this topic.

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
[Closed]: Download link on displayimage.php
« on: July 02, 2010, 01:14:18 pm »

http://psne-panasonic.com/copper/cpg15x/index.php

hello,
I am trying to add a download button to my site with limited success.

I have created a download.php and added some code to displayimage.php that creates a working download button at the bottom of my page.
I would like the download link under the image.  Please take a look at the attached image for a visual explanation.

Thanks in advance.

Jonathan
« Last Edit: July 06, 2010, 02:14:11 pm by Joachim Müller »
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #1 on: July 02, 2010, 01:16:26 pm »

Sorry should of added the content of my displayimage.php file

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2010 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.6
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/displayimage.php $
  $Revision: 7620 $
**********************************************/

define('IN_COPPERMINE'true);
define('DISPLAYIMAGE_PHP'true);
define('SMILIES_PHP'true);
define('INDEX_PHP'true);

require(
'include/init.inc.php');

if (!
USER_ID && ($CONFIG['allow_unlogged_access'] <= 1)) {

    
$redirect 'login.php';

    if (
$matches $superCage->server->getMatched('QUERY_STRING''/^[a-zA-Z0-9&=_\/.-]+$/')) {
        
$redirect .= '?force_login=1&referer='.urlencode('displayimage.php?'.$matches[0]);
    }

    
header("Location: $redirect");
    exit();
}

if (
USER_ID && (USER_ACCESS_LEVEL <= 1)) {
    
cpg_die(ERROR, ((USER_ACCESS_LEVEL == 1) ? $lang_errors['access_thumbnail_only'] : $lang_errors['access_none']));
}

if (!
$superCage->get->keyExists('slideshow')) {
    
js_include('js/displayimage.js');   
}

if (
$CONFIG['enable_smilies']) {
    include(
"include/smilies.inc.php");
}

$breadcrumb '';
$breadcrumb_text '';
$cat_data = array();

if (
$CONFIG['read_exif_data']) {
    include(
"include/exif_php.inc.php");
}

if (
$CONFIG['read_iptc_data']) {
    include(
"include/iptc.inc.php");
}

/**
 * Local functions definition
 */

// Sanitize the data - to fix the XSS vulnerability - Aditya
function sanitize_data(&$value$key)
{
    if (
is_array($value)) {
        
array_walk($value'sanitize_data');
    } else {
        
// sanitize against sql/html injection; trim any nongraphical non-ASCII character:
        
$value trim(htmlentities(strip_tags(trim($value"\x7f..\xff\x0..\x1f")), ENT_QUOTES));
    }
}

function 
html_picture_menu()
{
    global 
$lang_display_image_php$CURRENT_PIC_DATA$CURRENT_ALBUM_DATA$CONFIG;
    
    if ((
USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {

        
$delete_icon cpg_fetch_icon('delete'1);
        
$edit_icon   cpg_fetch_icon('edit'1);
        
$rotate_icon cpg_fetch_icon('rotate_ccw'1); 
        
        list(
$timestamp$form_token) = getFormToken();
        
$picmenu = <<< EOT
    <div class="buttonlist align_right">
<ul>
<li><a href="javascript:;" onclick="return MM_openBrWindow('pic_editor.php?id=
{$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')"><span>{$rotate_icon}{$lang_display_image_php['crop_pic']}</span></a></li>
<li><a href="edit_one_pic.php?id=
{$CURRENT_PIC_DATA['pid']}&amp;what=picture"><span>{$edit_icon}{$lang_display_image_php['edit_pic']}</span></a></li>
<li><a href="delete.php?id=
{$CURRENT_PIC_DATA['pid']}&amp;what=picture&amp;form_token={$form_token}&amp;timestamp={$timestamp}" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; "><span class="last">{$delete_icon}{$lang_display_image_php['del_pic']}</span></a></li>
</ul>
</div>
EOT;

    } else {
        
$picmenu '';
    }

    return 
$picmenu;
}

// Display picture information
function html_picinfo()
{
    global 
$CONFIG$CURRENT_PIC_DATA$CURRENT_ALBUM_DATA$THEME_DIR$FAVPICS$REFERER$CPG_PHP_SELF;
    global 
$album$lang_picinfo$lang_display_image_php$lang_byte_units$lang_common$lang_date$cpg_udb;

    if (
$CURRENT_PIC_DATA['owner_id']) {
        
$owner_link '<a href="profile.php?uid=' $CURRENT_PIC_DATA['owner_id'] . '">' $cpg_udb->get_user_name($CURRENT_PIC_DATA['owner_id']) . '</a> ';
    } else {
        
$owner_link '';
    }

    if (
GALLERY_ADMIN_MODE && $CURRENT_PIC_DATA['pic_raw_ip']) {
        if (
$CURRENT_PIC_DATA['pic_hdr_ip']) {
            
$ipinfo ' (' $CURRENT_PIC_DATA['pic_hdr_ip'] . '[' $CURRENT_PIC_DATA['pic_raw_ip'] . ']) / ';
        } else {
            
$ipinfo ' (' $CURRENT_PIC_DATA['pic_raw_ip'] . ') / ';
        }
    } else {
        if (
$owner_link) {
            
$ipinfo '/ ';
        } else {
            
$ipinfo '';
        }
    }

    
$info[$lang_common['filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);
    
$info[$lang_picinfo['Album name']] = '<span class="alblink">' $owner_link $ipinfo '<a href="thumbnails.php?album=' $CURRENT_PIC_DATA['aid'] . '">' $CURRENT_ALBUM_DATA['title'] . '</a></span>';
    
    
$votedetailsunhidetoggle_onload_added false;
    
    if (
$CURRENT_PIC_DATA['votes'] > 0) {
    
        if (
defined('THEME_HAS_RATING_GRAPHICS')) {
            
$prefix $THEME_DIR;
        } else {
            
$prefix '';
        }
        
        if (
GALLERY_ADMIN_MODE) {
            
$width 800;
            
$height 700;
        } else {
            
$width 400;
            
$height 250;
        }
        
        if (
$CONFIG['vote_details'] == 1) {
            
$stat_link "stat_details.php?type=vote&pid={$CURRENT_PIC_DATA['pid']}&sort=sdate&dir=&sdate=1&ip=1&rating=1&referer=0&browser=0&os=0&uid=1";
            
$detailsLink_votes '(<a href="' $stat_link '" class="greybox">' $lang_picinfo['show_details'] . '</a>)';
        } else {
            
$detailsLink_votes '';
        }
        
        
//calculate required amount of stars in picinfo
        
$i 1;
        
$rating round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / ($CONFIG['rating_stars_amount']));
        
$rating_images '';
 
        while (
$i <= $CONFIG['rating_stars_amount']) {

            if (
$i <= $rating) {
                
$rating_images .= '<img src="' $prefix 'images/rate_full.png" align="left" alt="' $rating '"/>';
            } else {
                
$rating_images .= '<img src="' $prefix 'images/rate_empty.png" align="left" alt="' $rating '"/>';
            }
            
            
$i++;
        }
        
        
$info[sprintf($lang_picinfo['Rating'], $CURRENT_PIC_DATA['votes'])] = $rating_images $detailsLink_votes;
    }

    if (
$CURRENT_PIC_DATA['keywords'] != '') {
        if (
$CONFIG['keyword_separator'] == ' ') {
            
$info[$lang_common['keywords']] = '<span class="alblink">' 
                
preg_replace("/([^{$CONFIG['keyword_separator']}]+)/"
                        
'<a href="thumbnails.php?album=search&amp;keywords=on&amp;search=$1">$1</a>'
                        
$CURRENT_PIC_DATA['keywords'])
                . 
'</span>';
        } else {
            
$keyword_links '';
            foreach (
explode($CONFIG['keyword_separator'], $CURRENT_PIC_DATA['keywords']) as $keyword) {
                
$keyword_links .= ($keyword_links ' '.$CONFIG['keyword_separator'].' ' '')
                        . 
'<a href="thumbnails.php?album=search&amp;keywords=on&amp;search='
                        
str_replace(' ''+'$keyword)
                        . 
'">' $keyword '</a>';
            }
            
$info[$lang_common['keywords']] = '<span class="alblink">' 
                
$keyword_links
                
'</span>';
        }
    }

    for (
$i 1$i <= 4$i++) {
        if (
$CONFIG['user_field' $i '_name']) {
            if (
$CURRENT_PIC_DATA['user' $i] != "") {
                
$info[$CONFIG['user_field' $i '_name']] = make_clickable($CURRENT_PIC_DATA['user' $i]);
            }
        }
    }

    
$info[$lang_common['filesize']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . '&nbsp;' $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . '&nbsp;' $lang_byte_units[0]);
    
$info[$lang_common['filesize']] = '<span dir="ltr">' $info[$lang_common['filesize']] . '</span>';
    
$info[$lang_picinfo['Date Added']] = localised_date($CURRENT_PIC_DATA['ctime'], $lang_date['lastup']);
    
$info[$lang_picinfo['Dimensions']] = sprintf($lang_display_image_php['size'], $CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']);
    
$info[$lang_picinfo['Displayed']] = sprintf($lang_display_image_php['views'], $CURRENT_PIC_DATA['hits']);

    if (
$CURRENT_PIC_DATA['hits'] && $CONFIG['hit_details'] && GALLERY_ADMIN_MODE) {
        
$stat_link "stat_details.php?type=hits&pid={$CURRENT_PIC_DATA['pid']}&sort=sdate&dir=&sdate=1&ip=1&search_phrase=0&referer=0&browser=1&os=1";
        
$info[$lang_picinfo['Displayed']] .= ' (<a href="' $stat_link '" class="greybox">' $lang_picinfo['show_details'] . '</a>)';
    }

    
$path_to_pic $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
    
$path_to_orig_pic $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['orig_pfx'] . $CURRENT_PIC_DATA['filename'];

    
// Read the iptc and EXIF data from original pic (if watermarked)
    
$metadata_path file_exists($path_to_orig_pic) ? $path_to_orig_pic $path_to_pic;
    
    if (
$CONFIG['read_exif_data']) {
    
        
$exif exif_parse_file($metadata_path$CURRENT_PIC_DATA['pid']);
    
        if (
is_array($exif)) {
            
array_walk($exif'sanitize_data');
            
$info array_merge($info$exif);
        }
    }
    
    
// Read the iptc data
    
if ($CONFIG['read_iptc_data']) {
          
        
$iptc get_IPTC($metadata_path);
    
        if (
is_array($iptc)) {
        
            
array_walk($iptc'sanitize_data');
            
            if (!empty(
$iptc['Title'])) {
                
$info[$lang_picinfo['iptcTitle']] = $iptc['Title'];
            }
            
            if (!empty(
$iptc['Copyright'])) {
                
$info[$lang_picinfo['iptcCopyright']] = $iptc['Copyright'];
            }
            
            if (!empty(
$iptc['Keywords'])) {
                
$info[$lang_picinfo['iptcKeywords']] = implode(' '$iptc['Keywords']);
            }
            
            if (!empty(
$iptc['Category'])) {
                
$info[$lang_picinfo['iptcCategory']] = $iptc['Category'];
            }
            
            if (!empty(
$iptc['SubCategories'])) {
                
$info[$lang_picinfo['iptcSubCategories']] = implode(' '$iptc['SubCategories']);
            }
        }
    }
    
    
// Create the absolute URL for display in info
    
$info[$lang_picinfo['URL']] = '<a href="' $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' '' '/') .basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}'" >' $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' '' '/') . basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}'</a>';

    
// Create the add to fav link
    
$ref $REFERER "&amp;referer=$REFERER'';
    
    if (!
in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        
$info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" $CURRENT_PIC_DATA['pid'] . $ref "\" >" $lang_picinfo['addFav'] . '</a>';
    } else {
        
$info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" $CURRENT_PIC_DATA['pid']  . $ref "\" >" $lang_picinfo['remFav'] . '</a>';
    }

    
/**
     * Filter file information
     */
    
$info CPGPluginAPI::filter('file_info'$info);

    return 
theme_html_picinfo($info);
}

/** Main code  */
$pos $superCage->get->getInt('pos');

/** Hack added by tarique to prevent incorrect picture being seen on last view or last uploaded */

$pid $superCage->get->getInt('pid');
$cat $superCage->get->getInt('cat');

/** TODO: Add the code to handle date parameter  */
//$date = $superCage->get->getInt('cat');
if ($superCage->get->testAlpha('album')) {
    
$album $superCage->get->getAlpha('album');
} else {
    
$album $superCage->get->getInt('album');
}

/** get ajax call to thumb photo slideshow*/
$ajax_show $superCage->get->getInt('ajax_show');

/** get AJAX call to run filmstrip */
$ajax_call $superCage->get->getInt('ajax_call');

// attempt to fix topn images for keyworded albums
if ($cat 0) {
    
$result cpg_db_query("SELECT category, title, aid, keyword, description, alb_password_hint FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='" . (- $cat) . "'");
    if (
mysql_num_rows($result) > 0) {
        
$CURRENT_ALBUM_DATA mysql_fetch_assoc($result);
        
$CURRENT_ALBUM_KEYWORD $CURRENT_ALBUM_DATA['keyword'];
    }
    
mysql_free_result($result);
}

get_meta_album_set($cat);

if (!
$superCage->get->keyExists('fullsize') && ($pos || $pid 0)) {

    
$pid = ($pos 0) ? -$pos $pid;
    
    if (!
$album) {
        
        
$result cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE pid='$pid$FORBIDDEN_SET LIMIT 1");

        if (
mysql_num_rows($result) == 0) {
            
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
        }

        
$row mysql_fetch_assoc($result);
        
mysql_free_result($result);
    }

    
$album = (!$album) ? $row['aid'] : $album;
    
    
// attempt to determine the position directly
    
$pos get_pic_pos($album$pid);
    
    if (
$pos === FALSE) {
    
        
$pic_data get_pic_data($album$pic_count$album_name, -1, -1false);
        
        for (
$pos 0$pic_data[$pos]['pid'] != $pid && $pos $pic_count$pos++);
        
        
reset($pic_data);
        
        
$CURRENT_PIC_DATA $pic_data[$pos];
    
    } else {
    
        
// load current pic details
        
$pic_data get_pic_data($album$pic_count$album_name$pos1false);
        
$CURRENT_PIC_DATA $pic_data[0];
  
        
// load prev, next, start and end for the navbar
        
if ($pos 0) {
            
$prev get_pic_data($album$pic_count$album_name$pos 11false'pidonly');
            
$pic_data[$pos 1] = $prev[0];
        }
  
        if (
$pos < ($pic_count -1)) {
            
$next get_pic_data($album$pic_count$album_name$pos 11false'pidonly');
            
$pic_data[$pos 1] = $next[0];
        }

        
$start get_pic_data($album$pic_count$album_name01false'pidonly');
        
$pic_data[0] = $start[0];
     
        
$end get_pic_data($album$pic_count$album_name$pic_count 11false'pidonly');
        
$pic_data[$pic_count 1] = $end[0];
    }
} elseif (isset(
$pos) && is_numeric($pos)) {
    
//$pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    //We must get all the data here as well, otherwise the prev/next breaks.
    
$pic_data get_pic_data($album$pic_count$album_name, -1, -1false);
 
    if (
$pic_count == 0) {
        
cpg_die(INFORMATION$lang_errors['no_img_to_display'], __FILE____LINE__);
    } elseif (
count($pic_data) == && $pos >= $pic_count) {
        
$pos $pic_count 1;
        
$human_pos $pos 1;
        
$pic_data get_pic_data($album$pic_count$album_name$pos1false);
    }
 
    
$CURRENT_PIC_DATA $pic_data[$pos];
}

if (!
$superCage->get->keyExists('fullsize') && !$superCage->get->keyExists('ajax_show') && !count($CURRENT_PIC_DATA)) {
    
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
}

/** add the assign variable work with jSlideshow */
set_js_var('position'$pos);
set_js_var('album'$album);
set_js_var('cat'$cat);
if (
$superCage->get->keyExists('msg_id')) {
    
set_js_var('msg_id'$superCage->get->getInt('msg_id'));
    
set_js_var('page'$superCage->get->getInt('page'));
}



/** if slideshow is has a key or ajax_show has a key then run jquery.slideshow.js */
if ($superCage->get->keyExists('slideshow') || $superCage->get->keyExists('ajax_show')) {
    
js_include('js/jquery.slideshow.js');
}

/** If we have film_strip key in GET then it means this is an ajax call for filmstrip */
if ($superCage->get->keyExists('film_strip')) {
    echo 
display_film_strip($album, (isset($cat) ? $cat 0), $postrue);
    exit;
}

/** if there is value for ajax_show key in GET then it means this is an ajax call to display sideshow. */
if ($superCage->get->keyExists('ajax_show')) {  
    
display_slideshow($pos$ajax_show);
    exit;
}

// Retrieve data for the current album
if (isset($CURRENT_PIC_DATA)) {

    
$ref_album = (is_numeric($album) ? $album $CURRENT_PIC_DATA['aid']);

    
$result cpg_db_query("SELECT title, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$ref_album}' LIMIT 1");

    if (!
mysql_num_rows($result)) {
        
cpg_die(CRITICAL_ERRORsprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE____LINE__);
    }
    
    
$CURRENT_ALBUM_DATA mysql_fetch_assoc($result);
    
mysql_free_result($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 (
$superCage->get->keyExists('fullsize')) {

    
theme_display_fullsize_pic();

} elseif (
$superCage->get->keyExists('slideshow')) {

    
$slideshow $superCage->get->getInt('slideshow');
    
set_js_var('run_slideshow''true'); 
    
display_slideshow($pos);
    
} else {

    if (!
$pos && !$pid) {
        
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 theme_html_img_nav_menu();
    
$picture theme_html_picture();
    
$votes theme_html_rating_box();
    
$pic_info html_picinfo();
    
$comments theme_html_comments($CURRENT_PIC_DATA['pid']);
    
    
$meta_keywords '';
    
    if (
$CURRENT_PIC_DATA['keywords']) {
        
$meta_keywords .= '<meta name="keywords" content="' str_replace($CONFIG['keyword_separator'], ','$CURRENT_PIC_DATA['keywords']) . '" />' $LINEBREAK;
    }

    
// Tell robots to ignore meta albums
    
if (!is_numeric($album)) {
        
$meta_keywords .= '<meta name="robots" content="noindex, nofollow" />' $LINEBREAK;
    }

    
$meta_keywords .= $meta_nav;
    
    
// Display Filmstrip if the album is not search -- commented out due to thread ID 64312
    //if ($album != 'search') {
        
$film_strip display_film_strip($album, (isset($cat) ? $cat 0), $postrue);
    
//}

    // Set the picture id for use in js
    
set_js_var('picture_id'$CURRENT_PIC_DATA['pid']);
    
pageheader($album_name ' - ' $picture_title$meta_keywordsfalse);
    
    
// Display Breadcrumbs
    
if ($breadcrumb && strpos($CONFIG['main_page_layout'], 'breadcrumb') !== false) {
        
theme_display_breadcrumb($breadcrumb$cat_data);
    }

    
CPGPluginAPI::filter('post_breadcrumb'null);
    
    
theme_display_image($nav_menu$picture$votes$pic_info$comments$film_strip);

    
pagefooter();

}



echo 
"<a href='";
echo 
"download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
echo 
$CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
echo 
"'>Download Image</a>";
$ref $REFERER "&amp;referer=$REFERER'';
    

echo 
"<a href='";
echo 
"addfav.php?pid=";
echo 
$CURRENT_PIC_DATA['pid'] ;
echo 
"'>Add Fav</a>";
$ref  $lang_picinfo['addFav'] ;







?>
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Download link on displayimage.php
« Reply #2 on: July 03, 2010, 08:25:35 am »

What's more important is the content of download.php, as that's the file where you can make most mistakes: you need to sanitize the input very, very carefully - the script allows to download http://psne-panasonic.com/copper/cpg15x/download.php?getfile=http://psne-panasonic.com/copper/cpg15x/displayimage.php (or any other file), although that file is empty. However, it's a first step to accomplish baaad things and definitely something I would be attacking first if I were a black hat.
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #3 on: July 05, 2010, 08:54:36 am »

Download.php works fine.

My question was about the layout.

I want to know how to position the links under the image.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Download link on displayimage.php
« Reply #4 on: July 05, 2010, 09:34:47 am »

You don't have to edit displayimage.php to change the layout. You'll need to edit themes/yourtheme/theme.php
This has been explained many times over already - take a look at the examples, e.g. in http://documentation.coppermine-gallery.net/en/theme_examples.htm#theme_examples_content_displayimage
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #5 on: July 05, 2010, 10:19:39 am »

I tryed that it has no effect

here is my theme.php code
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery Pana Theme
  ************************
  Copyright (c) 2010 Panasonic Web Team
  v1.0 originally written by Jonathan Cashmore
**********************************************/
define('THEME_HAS_MENU_ICONS'16);
define('THEME_HAS_FILM_STRIP_GRAPHIC',1);
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" >
                                <tr>
                                        <td align="center" style="{SLIDESHOW_STYLE}">
                                                {IMAGE}
                                        </td>
                                        <td align="center" style="{SLIDESHOW_STYLE}">
                                                Your custom content
                                        </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;

?>
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #6 on: July 05, 2010, 11:59:30 am »

fixed it. template was pulling theme.php from another theme.  none of my changes where making any difference.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4699
    • Windsurf.me
Re: Download link on displayimage.php
« Reply #7 on: July 05, 2010, 02:00:34 pm »

Logged
It is a mistake to think you can solve any major problems just with potatoes.

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #8 on: July 05, 2010, 02:29:11 pm »

Can you click the tick please - http://forum.coppermine-gallery.net/index.php/topic,55415.msg270631.html#msg270631
Will do, not 100% resolved yet.  Will tick as soon as fixed, will also post code.

Im no php guru so i need a little help with some code.
how do i implement this code
Code: [Select]
echo "<a href='";
echo "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
echo "'>Download Image</a>";
$ref = $REFERER ? "&amp;referer=$REFERER" : '';
into my theme.php

When i try it i get errors.  I think the above code is calling variables that exsist in displayimage.php?

Or maybe not, maybe there in one of the includes.  Im not sure.

Any help would be good
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: Download link on displayimage.php
« Reply #9 on: July 05, 2010, 02:49:25 pm »

http://psne-panasonic.com/copper/cpg15x/index.php
doesn't work for me (blank page).


how do i implement this code
Code: [Select]
echo "<a href='";
echo "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
echo "'>Download Image</a>";
$ref = $REFERER ? "&amp;referer=$REFERER" : '';
into my theme.php
Add it to the function theme_html_picture. Don't print it, but append it to an existing placeholder
Code: [Select]
   $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );
or create your own placeholder in $template_display_media.
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #10 on: July 05, 2010, 04:02:17 pm »

doesn't work for me (blank page).

Add it to the function theme_html_picture. Don't print it, but append it to an existing placeholder
Code: [Select]
   $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );
or create your own placeholder in $template_display_media.
Sorry i dont really understand what your saying.

my code is wrong in some way.  It works if i add it to the bottom of displayimage.php.  If i try to use the same code in theme.php the
Code: [Select]
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];line shows an error.  I guess its because I have not defined the variables correctly.

I'm at the limits of my php understanding.  I'm having a hard time, please help!!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: Download link on displayimage.php
« Reply #11 on: July 05, 2010, 04:36:29 pm »

It's not wrong, but just at the wrong place. Please search the board and read the docs. If you want more information, give more information!

Code: [Select]
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];shows an error.
Nice to know, but nobody can help you without the error message. As I already told you, you have to modify the function theme_html_picture. What do you expect when you post that piece of code to your theme.php file? How should Coppermine know what you want to accomplish?
Logged

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #12 on: July 05, 2010, 04:57:02 pm »

It's not wrong, but just at the wrong place. Please search the board and read the docs. If you want more information, give more information!
Nice to know, but nobody can help you without the error message. As I already told you, you have to modify the function theme_html_picture. What do you expect when you post that piece of code to your theme.php file? How should Coppermine know what you want to accomplish?

Ok ill try and provide more information

As show in the picture attached to my first post i would like to create a download link under the intermediate image.

this code works when tagged on to the bottom of my displayimage.php
Code: [Select]
echo "<a href='";
echo "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
echo "'>Download Image</a>";
$ref = $REFERER ? "&amp;referer=$REFERER" : '';
the same code does not work when i place it between the <tr> tags in the theme.php file like so.
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery Pana Theme
  ************************
  Copyright (c) 2010 Panasonic Web Team
  v1.0 originally written by Jonathan Cashmore
**********************************************/
define('THEME_HAS_MENU_ICONS'16);



/******************************************************************************
** 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 cellspacing="2" cellpadding="0" >
                                 <tr>
    <td align="center" style="{SLIDESHOW_STYLE}">
    {IMAGE}
  </tr>
  <tr>
    <td align="center" style="{SLIDESHOW_STYLE}">
echo "<a href='";
echo "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
echo 
$CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
echo "'>Download Image</a>";
$ref = $REFERER ? "&amp;referer=$REFERER" : '';


  </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
******************************************************************************/



?>

I get a syntax error on the line that contains
Code: [Select]
echo $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
I dont understand what you mean by "you have to modify the function theme_html_picture"
I assume you mean the massive function
Code: [Select]
/******************************************************************************
** Section <<<theme_html_picture>>> - START
******************************************************************************/
// Displays a picture
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $LINEBREAK;
    global $album, $lang_date, $template_display_media;
    global $lang_display_image_php, $lang_picinfo, $lang_common, $lang_errors;

    $superCage = Inspekt::makeSuperCage();

    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';

    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && !in_array($pid, $USER['liv']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
    }

    // The weird comparision is because only picture_width is stored
    if ($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ) {
        $condition = true;
    } elseif ($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) {
        $condition = true;
    } elseif ($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
        //thumb cropping
    } elseif ($CONFIG['thumb_use']=='ex' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
    } else {
        $condition = false;
    }

    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . $LINEBREAK;
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . $LINEBREAK;
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_common['keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }

    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }

    $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';

    $image_size = array();

    if ($CONFIG['make_intermediate'] && $condition ) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }

    list($image_size['width'], $image_size['height'], , $image_size['geom']) = cpg_getimagesize(urldecode($picture_url));

    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);

    if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {

        if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
            $resize_method = $CONFIG['picture_use'] == "thumb" ? ($CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use']) : $CONFIG['picture_use'];
            if ($resize_method == 'ht') {
                $pwidth = $CONFIG['picture_width']*4/3;
                $pheight = $CONFIG['picture_width'];
            } else {
                $pwidth = $CONFIG['picture_width'];
                $pheight = $CONFIG['picture_width']*3/4;
            }

            $CURRENT_PIC_DATA['pwidth']  = $pwidth; // Default width

            // Set default height; if file is a movie
            if ($mime_content['content']=='movie') {
                $CURRENT_PIC_DATA['pheight'] = $pheight; // Default height
            }
        }

        $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;
        $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
    }

    if ($mime_content['content']=='image') {
        if ($CURRENT_PIC_DATA['mode'] != 'fullsize') {
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + $CONFIG['fullsize_padding_x'];  //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + $CONFIG['fullsize_padding_y']; //the +'s are the mysterious FF and IE paddings
            if ($CONFIG['transparent_overlay'] == 1) {
                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$image_size['width']}\" height=\"{$image_size['height']}\" class=\"image\">";
                $pic_html_href_close = '</a>' . $LINEBREAK;
                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                    if ($CONFIG['allow_user_registration'] == 0) {
                        $pic_html_href_close = '';
                    } else {
                        $pic_html .= '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');">';
                    }
                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                    $pic_html .= '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');">';
                } else {
                    $pic_html .= "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
                }
                $pic_title = $lang_display_image_php['view_fs'] . $LINEBREAK . '==============' . $LINEBREAK . $pic_title;
                $pic_html .= "<img src=\"images/image.gif?id=".floor(rand()*1000+rand())."\" width=\"{$image_size['width']}\" height=\"{$image_size['height']}\"  border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= $pic_html_href_close . '</td></tr></table>';
                //PLUGIN FILTER
                $pic_html = CPGPluginAPI::filter('html_image_reduced_overlay', $pic_html);
            } else {
                $pic_html_href_close = '</a>' . $LINEBREAK;
                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                    if ($CONFIG['allow_user_registration'] == 0) {
                        $pic_html = $pic_html_href_close = '';
                    } else {
                        $pic_html = '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');">';
                    }
                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                    $pic_html = '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');">';
                } else {
                    $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
                }
                $pic_title = $lang_display_image_php['view_fs'] . $LINEBREAK . '==============' . $LINEBREAK . $pic_title;
                $pic_html .= "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= $pic_html_href_close;
                //PLUGIN FILTER
                $pic_html = CPGPluginAPI::filter('html_image_reduced', $pic_html);
            }
        } else {
            if ($CONFIG['transparent_overlay'] == 1) {
                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$CURRENT_PIC_DATA['pwidth']}\" height=\"{$CURRENT_PIC_DATA['pheight']}\" class=\"image\">";
                $pic_html .= "<img src=\"images/image.gif?id=".floor(rand()*1000+rand())."\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} border=\"0\" alt=\"\" /><br />" . $LINEBREAK;
                $pic_html .= "</td></tr></table>";
                //PLUGIN FILTER
                $pic_html = CPGPluginAPI::filter('html_image_overlay', $pic_html);
            } else {
                $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />" . $LINEBREAK;
                //PLUGIN FILTER
                $pic_html = CPGPluginAPI::filter('html_image', $pic_html);
            }
        }
    } elseif ($mime_content['content']=='document') {
        $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a><br />" . $LINEBREAK;
        //PLUGIN FILTER
        $pic_html = CPGPluginAPI::filter('html_document', $pic_html);
    } else {
        $autostart = ($CONFIG['media_autostart']) ? ('true'):('false');

        if ($mime_content['player'] == 'HTMLA') {
            $pic_html  = '<audio controls="true" src="' . $picture_url . '" autostart="' . $autostart . '"></audio>';
        } elseif ($mime_content['player'] == 'HTMLV') {
            $pic_html  = '<video controls="true" src="' . $picture_url . '" autostart="' . $autostart . '"' . $image_size['whole'] . '></video>';
        } else {

            $players['WMP'] = array('id' => 'MediaPlayer',
                                    'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
                                    'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
                                    'mime' => 'type="application/x-mplayer2" ',
                                   );
            $players['DIVX'] = array('id' => 'DivX',
                                    'clsid' => 'classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616"',
                                    'codebase' => 'codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"',
                                    'mime' => 'type="video/divx"'
                                   );
            $players['RMP'] = array('id' => 'RealPlayer',
                                    'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
                                    'codebase' => '',
                                    'mime' => 'type="audio/x-pn-realaudio-plugin" '
                                   );
            $players['QT']  = array('id' => 'QuickTime',
                                    'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
                                    'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
                                    'mime' => 'type="video/x-quicktime" '
                                   );
            $players['SWF'] = array('id' => 'SWFlash',
                                    'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
                                    'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
                                    'mime' => 'type="application/x-shockwave-flash" '
                                   );
            $players['UNK'] = array('id' => 'DefaultPlayer',
                                    'clsid' => '',
                                    'codebase' => '',
                                    'mime' => ''
                                   );

            $player = $players[$mime_content['player']];

            if (!$player) {
                $player = 'UNK';
            }

            $pic_html  = '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
            $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
            $pic_html .= '</object><br />' . $LINEBREAK;
        }

        //PLUGIN FILTER
        $pic_html = CPGPluginAPI::filter('html_other_media', $pic_html);
    }

    $CURRENT_PIC_DATA['html'] = $pic_html;
    $CURRENT_PIC_DATA['header'] = '';
    $CURRENT_PIC_DATA['footer'] = '';

    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

    return template_eval($template_display_media, $params);
}
/******************************************************************************
** Section <<<theme_html_picture>>> - END
******************************************************************************/

I dont know where to place my code so that a link appears under the image.



Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: Download link on displayimage.php
« Reply #13 on: July 05, 2010, 06:31:16 pm »

Thanks for providing no more info. I'm able to summarize your posted infos on my own ::)

I assume you mean the massive function
Yes.

Search
Code: [Select]
    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );
and replace with
Code: [Select]
$dl_button = "<a href='";
$dl_button .= "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
$dl_button .= $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
$dl_button .= "'>Download Image</a><br /><br />";

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => $dl_button.bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

If it doesn't work and you are still not able to write a help request with useful info, I'll ignore it. Sorry.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Download link on displayimage.php
« Reply #14 on: July 05, 2010, 07:03:58 pm »

We expect you to read the documentation sections that we refer to. André told you what you need to do twice:
you have to modify the function theme_html_picture.
. Read up how to accomplish that in http://documentation.coppermine-gallery.net/en/theme_theme_php.htm - it is explained there very detailed. Pay particular attention to the summary box at the very bottom of that page. This is not rocket science.
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1503
  • aka 'i-imagine'
    • Home Page
Re: Download link on displayimage.php
« Reply #15 on: July 05, 2010, 09:15:35 pm »

In the interest of saving current and future time and electrons in another mod. thread I have made a simple plugin that will do what the poster wants (within limits, of course). I hope to release it later today once the package is complete.

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1503
  • aka 'i-imagine'
    • Home Page
Re: Download link on displayimage.php
« Reply #16 on: July 05, 2010, 11:54:29 pm »

See this link:Add Download Link

drmore

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Download link on displayimage.php
« Reply #17 on: July 06, 2010, 09:19:52 am »

Thanks for providing no more info. I'm able to summarize your posted infos on my own ::)
Yes.

Search
Code: [Select]
    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );
and replace with
Code: [Select]
$dl_button = "<a href='";
$dl_button .= "download.php?getfile=http://psne-panasonic.com/copper/cpg15x";
$dl_button .= $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
$dl_button .= "'>Download Image</a><br /><br />";

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => $dl_button.bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

If it doesn't work and you are still not able to write a help request with useful info, I'll ignore it. Sorry.
Great that's exactly what I needed, now I understand what you was trying to tell me. 


We expect you to read the documentation sections that we refer to. André told you what you need to do twice:. Read up how to accomplish that in http://documentation.coppermine-gallery.net/en/theme_theme_php.htm - it is explained there very detailed. Pay particular attention to the summary box at the very bottom of that page. This is not rocket science.
Well done, you just lost a substantial donation. Good work.

For your information I am a php novice, I read your documentation and it didn't make sense.  You directed me to some code that I didn't need to edit.  Maybe you should rethink how you treat people that need help.  Not everyone will be able understand your code and documentation instantly.

I tryed to work it out on my own for three days before I asked in your forums. Instead of providing accurate useful help you say things like look at this useless information and edit some code with no explanation of what your talking about. 

My question could of been answered and resolved in one post if you had made an effort to understand what I was asking.

Your rudeness just lost you a few hundred euros.  Hope you feel good about yourself.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: Download link on displayimage.php
« Reply #18 on: July 06, 2010, 10:58:45 am »

My question could of been answered and resolved in one post if you had made an effort to understand what I was asking.
Your question could of been answered and resolved by searching the board, as your question has been asked so many times before. We just want to help you to help yourself and don't want to spoon-feed you. I've done that in my last post, as I lost the patience.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Download link on displayimage.php
« Reply #19 on: July 06, 2010, 02:13:55 pm »

Well done, you just lost a substantial donation. Good work.
Your rudeness just lost you a few hundred euros.  Hope you feel good about yourself.
That's a blatant lie - you never intended to donate that much money. You're just posting such nonsense to pressurerize us. I've seen that before, and I'm not sorry having posted what I said above. André clearly told you what you needed to do to enable him to help you, yet you ignored that. Joe even coded a custom plugin for you, yet you moan and complain and didn't even thank him. I suggest you review your attitude, as I'm pretty sure that Panasonic wouldn't want to see their employees act as you did; your attitude shines back on you and the company you appear to be working for.
Locking

Joachim
Logged
Pages: [1]   Go Up
 

Page created in 0.041 seconds with 20 queries.