Hey Everyone!
GOT IT WORKING!!!
Here's Jan's original code from page 2:
$additional_download_sizes = array(72, 120, 300);
$register_array = array();
foreach ($additional_download_sizes as $size) {
ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
$file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
$register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
}
else {
$register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&size2=".$size."&size=".$size)."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
$register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&".URL_IMAGE_ID."=".$image_row['image_id']."&size2=".$size."&size=".$size)."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
}
}
$site_template->register_vars($register_array);
And here's what I changed it to:
$additional_download_sizes = array(1024);
$register_array = array();
foreach ($additional_download_sizes as $size) {
ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
$file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
if (!check_permission("auth_download_$size", $image_row['cat_id'])) {
$register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off_$size.gif")."\" border=\"0\" alt=\"\" />";
$register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off_$size.gif")."\" border=\"0\" alt=\"\" />" : "";
}
else {
$register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&size=".$size)."\"".$target."><img src=\"".get_gallery_image("download_$size.gif")."\" border=\"0\" alt=\"\" /></a>";
$register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&".URL_IMAGE_ID."=".$image_row['image_id']."&size=".$size)."\"><img src=\"".get_gallery_image("download_zip_$size.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
}
}
$site_template->register_vars($register_array);
So this:
if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
was changed to this:
if (!check_permission("auth_download_$size", $image_row['cat_id'])) {
So now my non-registered visitors will only be able to download 800 x 600 wallpapers, but my registered visitors will be able to download both 800 x 600 and 1024 x 768 wallpapers. And for the non-registered visitors it shows the 1024 x 768 buttons, but they are greyed out, and there are no links showing even in page source, so they can't get the link to the bigger size!
Joanne