Well I understand the security point of view, and that has been on my mind since I created the watermark hack. The only way I can see round this is to place the whole album directory outside of the web root so it's impossible to access them via a browser, yet the scripts can still access them to watermark & output them.
Just thinking about this now, I have no idea what effect this would have on the rest of the coppermine code, I'm not entirely sure if it's as simple as setting up your config files/options and changing the location of the albums directory. However, I imagine that it is possible. Also, not all webhosts let you put things outside the web root.
But if you'd like thumbnails watermarked as well, just change this code:
if((($mode == "normal") || ($mode == 'fullsize')) && ($CONFIG['thumb_method']=='im')){
// return the url to the wm script
return "wm.php?pid=".$pic_row["pid"]."&mode=".$mode;
}else{
// it's a thumb, don't bother wm'ing
return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
}
to this:
if($CONFIG['thumb_method']=='im'){
// return the url to the wm script
return "wm.php?pid=".$pic_row["pid"]."&mode=".$mode;
}else{
// ok so we're not using ImageMagick, so can't wm it...
return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
}
I've not tested that, but it should work as it's just taking out a couple of the if clauses. Test it and let me know.
I also looked into the possibility of using seperate watermark images for each of the 'normal', 'thumb' and 'fullsize' images since I think the wm should be scaled for each one of these... Let me know if you'd like me to look into that, shouldn't be difficult to do...
Cheers,
Flex
