Album Description on Image Display Page Album Description on Image Display Page
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Album Description on Image Display Page

Started by Prisoner_24601, January 16, 2006, 11:09:03 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Prisoner_24601

Again, thanks to Paver who coded a Plugin to search Album Descriptions for me (see http://forum.coppermine-gallery.net/index.php?topic=26483.0).

Here's a related request:

When I go to the displayimage page, I get the following info, standard:

QuoteFilename:
Album name:
File Size:
Date added:
Dimensions:
Displayed:
URL:
Favorites:

... in a section entitled "File Information".

Is it possible to get the data from Album Description on this page, preferably in addition to the above?  The closest I found to a way of doing this is probably http://forum.coppermine-gallery.net/index.php?topic=8946.0, but this is for CPG 1.3 and refers to files and directories that don't seem to exist in 1.43.

I'm going to experiment with the CMS, later, but I really don't want to have to enter information twice.

Thanks!

Paver

I'm working on a plugin that reorganizes the file information on the photo page and I was able to easily add the album description as well.  The plugin is not quite ready but I think it will be soon.

Plugins are preferrable for many reasons, but here's a 2-line hack that does what you want.  All the following refers to the script displayimage.php.

Look for this line in the function html_picinfo():
    $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . $ipinfo . '<a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . '</a></span>';
Add this line after it:
$info['Album description'] = $CURRENT_ALBUM_DATA['description'];

Look for these lines near the end:
/ Retrieve data for the current album
if (isset($CURRENT_PIC_DATA)) {
    $result = cpg_db_query("SELECT title, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1");

In the last line, add in 'description' after 'title' as shown:
    $result = cpg_db_query("SELECT title, description, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1");

And that should do it.  This hack is not lang-compatible since you use the static text 'Album description', but to use the variable $lang_modifyalb_php['alb_desc'] which would be language-compatible requires a bit more of a hack since that variable is only set for the modifyalb script.  In any case since this is a hack, I figured it didn't have to be language-compatible.  If you do want it to be, you need to do the following:

At the beginning of displayimage.php, before the require line, add this line:
define('MODIFYALB_PHP', true);
At the beginning of the function html_picinfo(), add this line:
    global $lang_modifyalb_php;
Finally, instead of the line above, use this line in the same place:
$info[$lang_modifyalb_php['alb_desc']] = $CURRENT_ALBUM_DATA['description'];

This second hack may be dangerous in the future though since it makes the displayimage.php script pretend to be the modifyalb.php script and that may break things in the future.  Right now, it's OK.  There is a way to be safer about this pretense,  but not completely safe so let's just leave it at that.

In any case, my plugin will do what you want once it's ready.

Prisoner_24601

You're awesome.  Thanks.

I've seen quite a few posts from folks that want this -- and for some, this is a "make or break" feature.

Prisoner_24601

Hacked my code (made backups, first).  Works.  Didn't try hack, pt. II, because I didn't want the possibility of something breaking in the future.

The one disadvantage with this hack is that this renders your BBCode input in ALBUM DESCRIPTION as plain text on the displayimage.php page.

This will most definitely tide me over until you've got the plugin ready, though.  Thanks again.

Paver

Oh, right.  I forgot about the BBcode.  Thanks for mentioning it.  That should be easy to add in to the hack and to my plugin.  I'll take a look when I can.

As for breaking things in the future, keep in mind that you'll have to re-apply any hacks you do to future versions, so you might as well hack something that works fine now (like the language-compatible hack) and if that same hack breaks in a future version, you can apply the simpler hack.  Of course, if you don't use other languages, the point's moot.  One tip to keep hacks under control is to add a comment on a line above with a unique tag like your name or initials so it's easy to search out where you put the hacks.  Keeping a list somewhere is useful too, ideally with links to the threads or a copy of each hack instructions.

This is one big reason to keep things in plugins which can be easily added & removed and easily tested & upgraded for future versions.

Paver

I added a plugin to filter the "File Information" on the Image Display page, which adds "album description" as one of the choices.

I forgot to implement BBCode evaluation, so I'll do that with the next release.  I was reminded when I searched for this thread to tell you a plugin was ready.   :)

Prisoner_24601

Downloaded and installed.  Works nice.  Thanks!

cb528

Quote from: Paver on February 03, 2006, 10:19:56 PM
I added a plugin to filter the "File Information" on the Image Display page, which adds "album description" as one of the choices.

I forgot to implement BBCode evaluation, so I'll do that with the next release.  I was reminded when I searched for this thread to tell you a plugin was ready.   :)


Hi, sorry to bring this topic from the dead, but I can't find this plugin/hack in the mods forum. You didn't mention what the name was and I havent been able to find it using search

Paver