Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Album Description on Image Display Page  (Read 3362 times)

0 Members and 1 Guest are viewing this topic.

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Album Description on Image Display Page
« on: January 16, 2006, 11:09:03 pm »

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:

Quote
Filename:
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!
« Last Edit: February 04, 2006, 04:23:18 pm by Paver »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Album Description on Image Display Page
« Reply #1 on: January 17, 2006, 06:54:50 pm »

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():
Code: [Select]
    $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:
Code: [Select]
$info['Album description'] = $CURRENT_ALBUM_DATA['description'];
Look for these lines near the end:
Code: [Select]
/ 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:
Code: [Select]
    $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:
Code: [Select]
define('MODIFYALB_PHP', true);At the beginning of the function html_picinfo(), add this line:
Code: [Select]
    global $lang_modifyalb_php;Finally, instead of the line above, use this line in the same place:
Code: [Select]
$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.
Logged

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Re: Album Description on Image Display Page
« Reply #2 on: January 17, 2006, 08:48:45 pm »

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.
Logged

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Re: Album Description on Image Display Page
« Reply #3 on: January 17, 2006, 10:28:23 pm »

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.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Album Description on Image Display Page
« Reply #4 on: January 17, 2006, 11:08:40 pm »

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.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Album Description on Image Display Page
« Reply #5 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.   :)
Logged

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Re: Album Description on Image Display Page
« Reply #6 on: February 04, 2006, 04:18:31 pm »

Downloaded and installed.  Works nice.  Thanks!
Logged

cb528

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Album Description on Image Display Page
« Reply #7 on: August 14, 2006, 01:37:15 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
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Album Description on Image Display Page
« Reply #8 on: August 14, 2006, 02:19:21 pm »

All contributed plugins are on the plugin contributions board, which is under the cpg 1.4 plugins support board.

Here's a direct link to the plugin you want: http://forum.coppermine-gallery.net/index.php?topic=27407.0
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.