Ok, I searched around, and with Nibbler's redirect to the new location of the code, I came up with this solution, which worked beautifully:
Step 1) Create download.php
Copy/paste this code into a file called download.php, and put it in the Coppermine application root:
<?php
//
// hack to allow downloading of pictures and movies
// see http://forum.coppermine-gallery.net/index.php?topic=6464.0
//
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();
?>
Step 2) Change theme.php
Open the theme.php for the theme your're using.
FIND: $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";
REPLACE WITH: $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.php?pid={$CURRENT_PIC_DATA['pid']}\">Click here to download</a></p>";
That should do you. In addition to the media file opening in an embedded player now, a link to download will display.
Zane