coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: celandine on August 25, 2008, 12:54:43 PM

Title: How to avoid album thumbnail repetition inside the album?
Post by: celandine on August 25, 2008, 12:54:43 PM
Just set up album thumbnails which I understood to become 'cover icons' to identify each of my main albums.
Opened each album to find the cover thumbnail on the inside. Is there a means to prevent this repetition?

I searched for this and found
QuoteRe: Icon for Album Name on Thumpages appears twice
but the code referred to in theme.php is no longer there in my (latest) version.

Or will the album thumbnail be sent to the back and become lost as more images are added to each album?
Title: Re: How to avoid album thumbnail repetition inside the album?
Post by: Gizmo on August 25, 2008, 02:55:00 PM
If you set the album cover pic as in the instructions (http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#modif_alb_pics) then this pic will always be used. If you wish to have a cover pic but not have this pic appear in the album then you will need to copy these two variables ($template_album_list and $template_album_list_cat) from the sample theme theme.php and paste them into your template theme.php before the end ?> then edit the line
<a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>

In place of
{ALB_LINK_PIC}

add an image tag with the pic link of your choice. I'm not where I can be more specific until later today if you need more info but this should get you going.
Title: Re: How to avoid album thumbnail repetition inside the album?
Post by: celandine on August 26, 2008, 10:47:23 AM
Thanks for responding Gizmo.
Added both variables as suggested before adding the image tag with 'no apparent change in the result. But even if it had worked, by adding the img tag as you suggest wouldn't that simply upload the same image for all my album covers? (I've got ten very different albums).
Title: Re: How to avoid album thumbnail repetition inside the album?
Post by: Gizmo on August 26, 2008, 06:16:21 PM
Yes you are right and I apologize for that. I was working from my handheld and wasn't able to test it at the time. In order to do what you want, you will need to write code to apply a different image to each album.

As a side note the right format to use is
<a href="{ALB_LINK_TGT}" class="albums"><img class="image" height="X" width="Y" border="0" alt="some text here" src="image location"/><br /></a>

[EDIT] Check out this post on album thumbnails (http://forum.coppermine-gallery.net/index.php/topic,10914.0.html). This looks very promising for what you want to do.
Title: Re: How to avoid album thumbnail repetition inside the album?
Post by: Gizmo on August 26, 2008, 10:45:31 PM
I wanted to get to the bottom of this so here's the instructions for getting this done.

in functions.inc.php (CPG v1.4.19)
find on line 956:

                $query = "SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE ((aid='$album' $forbidden_set_string ) $keyword) $approved $ALBUM_SET ORDER BY $sort_order $limit";


replace with:

                $query = "SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album Thumbnail Only' AND ((aid='$album' $forbidden_set_string ) $keyword) $approved $ALBUM_SET ORDER BY $sort_order $limit";


then find on line 1232:

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET ORDER BY RAND() LIMIT $limit2";


replace with:

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album Thumbnail Only' AND approved = 'YES' $META_ALBUM_SET ORDER BY RAND() LIMIT $limit2";


Now if the image you want to use isn't in the album yet, upload it as usual. Using the Album Admin Menu > Edit Files change the Title to Album Thumbnail Only. Now the pic won't show in the album or in the Random Files. If you have statistics turn on for albums it will show 3 files but only 2 will be visible.

To make the image viewable again in the album, remove Album Thumbnail Only from the title.

Pretty cool!  ;D