Download and Alternate File Loading

This plugin serves two very connected purposes.  First of it provides a download link directly above the filename.  The link can be left clicked on and a save as dialogue box appears because the file is transferred through a PHP script.

This leads me to the scripts next functionality that requires a small mod to make it fully functional.  The plugin explains the modification of adding a single line of code.  This script changes all of the file's URLs so that they load through a PHP script.  Now I have not gotten around to adding the security features that I want but it does help with the web server logs.  The plugin simply loads the pictures using the PID and the version that was requested.  This plugin does sacrifice speed because there are two additional queries for each picture that is displayed.  One to lookup the PID and one to look up the file path with the first being part of the page and the second being part of each image.

The modification that goes along with this plugin is as follows:

Find The Line:
return $pic_row['url'];

Place This Line of Code Immediately Before It:
$pic_row = CPGPluginAPI::filter('picture_url',$pic_row);

Be aware that without the modification no error message will be given and the pictures will simply not load through the script.

I hope this helps.  It is a straight forward script and includes some comments about the code.

I do know that there are other similar scripts but I have not seen one yet in the form of a plugin.  The plugin feature allows for very easy installation (besides the fact there is one very small mod).  In my personal opinion this plugin hook would be one that would be very convient in the next version of Coppermine, but I am not a developer. Wink

Additionally, this plugin may not work on versions of Coppermine that have been modified but the placement of the hook ensures that all files will be loaded through the script, with the exception of those that are file type specific.

Version 1.1: Added security that used MD5 to prevent someone from just changing the PID in the URL to access the next picture.
Version 1.2: Fixed an error with the download link caused by the MD5 security.
Version 1.3: Extensive rewrite that changed the way the plugin determines the PID for each image.  Optimized some code that determines which file to load through the script.

http://coppermine-gallery.net/forum/index.php?topic=32348.0