Note: This post gives the most recent version of this plugin. The original post that announced the first release of this plugin is provided below the version list.
This plugin allows you to control access to the full-size and intermediate photos/files by usergroup. Versions 1.2 and earlier only control the full-size photo. Versions 1.3 and later include intermediate photo/file control. You may read the CHANGELOG included with the plugin to follow the development, as well as read this thread.
Full-size photo restriction is done by removing the link on the intermediate (displayimage.php) page. Note that users can still access the full-size photos by guessing & typing in the URL to the file directly into their web browsers (which avoids Coppermine completely). You must use some sort of hot-linking protection (described in other threads) to stop such access. This plugin only restricts access through Coppermine.
Intermediate photo/file restriction is done by removing the link on the corresponding thumbnail and also by denying access to the intermediate page for the file. Once again, the full-size and intermediate files can still be accessed by typing in the direct URL to the files (which avoids Coppermine completely).
Version 1.0 is the initial release and is described at the bottom of this post.
Version 1.1 is described in
this post below.
Version 1.1b is a bug-fix. I mistakingly hard-coded the config table in 2 queries.
Version 1.2 is described in
this post below.
Note: Even though the filename says 1.4.2, this plugin works with the entire 1.4.x series.
Version 1.3 is described in
this post below. The main addition is the control of intermediate images. Versions prior to 1.3 only controlled the full-size images.
Version 1.4 is described in
this post below. This version includes an option to control images only and a message hover/box for the intermediate file control.
Original posting (for version 1.0):Here's my first plugin contribution. It's very simple. You select which groups you allow to access full-size photos and it does the access validation for you. This access control is gallery-wide, no choices for categories or albums. You configure the groups on installation. If you want to change this, uninstall and re-install. (I hope there's a plan to add a "configure" button to installed plugins so that the configure function can be run after installation. Yes I could put together an admin page for the plugin but it seems to me that a simple configure button would be useful and logical and easy to implement.)
This plugin takes a scorched-earth method of filtering the <img src> tag; it kills all other tags (and then blanks out the alt attribute appropriately).
A few thoughts I had while writing this plugin:
- If groupmgr.php had a plugin hook, I could add a "allow full-size access" setting there.
- I assume it's OK to add plugin config settings to 'cpg_config'. It seems to me that configuration settings for plugins belong there, with maybe the caveat that the names should be prefixed by "plugin_" and then the shortplugin name (as I did). If people agree, I think this guideline for config settings should go on the guideline list in the sticky thread above.
- The 'file_data' filter is only used in themes.inc.php (so the following discussion is not relevant in this case) but I was wondering if it's possible for the plugin function to figure out which function or script called the plugin function. Besides searching passed parameters for certain patterns, it seems to me that knowing from whence the plugin function was called might be useful.
- Finally, I haven't yet figured out the advantages or disadvantages of using the 'uninstall' action versus using the 'cleanup' action. Any tips on that?
Versions 1.2 and 1.4 of the plugin are available for download below.
[Edited By Sami]:
Minor Bug fixThere is a
minor template bug on both version of this plugin,
position of intermediate image get little messy
to fix this problem you need to edit codebase.php and change
$cpicdata['html'] = strip_tags($cpicdata['html'],'<img>');
to this
$cpicdata['html'] = strip_tags($cpicdata['html'],'<img><br>');