Skip to content

Image Download Link (Version 1.4.x)

Im Coppermine Root Directory eine Datei namens download_images.php anlegen und folgenden Code hineinkopieren:

<?php
     if ($_REQUEST ['getfile']){
        $file = $_REQUEST ['getfile'];
     
     }
$save_as_name = basename($file);  
ini_set('session.cache_limiter', '');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
header("Content-Type: application/octet-stream");
header("Content-Disposition: disposition-type=attachment; filename=\"$save_as_name\"");
readfile($file);
?>
 


Anschließend muss das theme.php (Pfad zu Deiner Gallery >> themes >> Dein gewähltes Theme) noch wie folgt bearbeitet werden!

Suche nach folgenden Code:

if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth']+5;  //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
            $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
            $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
            $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
            $pic_html .= "</a>\n";
 


Und ersetze ihn mit diesen:

        if ($mime_content['content']=='image') {
            if (isset($image_size['reduced'])) {
                $filesize = $CURRENT_PIC_DATA['filesize'];
                $filesizecorr = intval($filesize/1024);
                $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
                $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
                $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
                $picturefs_url = str_replace("normal_", "", $picture_url);
                $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
                $pic_html .= "<center><img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /></center><br />";
                $pic_html .= "<center><a href=\"download_images.php?getfile=$picturefs_url\">Hier klicken, um das Bild zu downloaden!<br /> ($filesizecorr KB) <br /></a><br /></center>";
               $pic_html .= "</a>\n";
 

Video Download Link (Version 1.4.x)

Im Coppermine Root Directory eine Datei namens download_video.php anlegen und folgenden Code reinkopieren:

<?php
define('IN_COPPERMINE',true);
define('UPLOAD_PHP',true);
define('DOWNLOAD_PHP',true);
require('include/init.inc.php');
function download()
{
        global $CONFIG, $lang_upload_php, $FORBIDDEN_SET;
        $pid = (int) $_GET['pid'];
        $sql = 'select '.
                'p.filepath,'.
                'p.filesize,'.
                'p.filename,'.
                $CONFIG['TABLE_ALBUMS'].'.visibility, '.
                'p.aid as aid '.
                'from '.$CONFIG['TABLE_PICTURES'].' as p LEFT JOIN '.$CONFIG['TABLE_ALBUMS'].
                ' ON (p.aid = ' . $CONFIG['TABLE_ALBUMS'].'.aid ) '.
                ' where pid='.$pid.' and approved="YES"';
        if (!empty($FORBIDDEN_SET)) {
                $sql .= ' and '.$FORBIDDEN_SET;
        }
        $result = cpg_db_query($sql);
        // No data returned; Display an error page
        if (mysql_num_rows($result)==0) {
                mysql_free_result($result);
                cpg_die(CRITICAL_ERROR,$lang_upload_php['unknown']);
        }
        $file = mysql_fetch_assoc($result);
        mysql_free_result($result);
        // Empty output buffer
        while(ob_get_level()>0) {
                ob_end_clean();
        }
        // Send binary information to the browser
        header("Content-type: application/octet-stream");
        header("Content-disposition: attachment; filename=".$file['filename']);
        header("Content-Length: ".$file['filesize']);
        header("Pragma: no-cache");
        header("Expires: 0");
        readfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);
}
download();
?>
 


Anschließend muss das theme.php (Pfad zu Deiner Gallery >> themes >> Dein gewähltes Theme) noch wie folgt bearbeitet werden!

Suche nach folgenden Code:

$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 .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'"'.$player['mime'].'></embed>';
$pic_html .= "</object><br />\n";
 


Und ersetze ihn mit diesen:

$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 .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
$pic_html .= "</object><br />\n";
$pic_html .= "<p><a href=\"download_video.php?pid={$CURRENT_PIC_DATA['pid']}\">Hier klicken, um das Video zu downloaden!</a></p>";