forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: rap.nospam on July 26, 2007, 08:39:56 am

Title: Change lastalb function to display album thumbnail?
Post by: rap.nospam on July 26, 2007, 08:39:56 am
Hi,

I have activated the lastalb display on my galleries main page (http://www.pollai.at) and it works fine, the only thing I notice it that it somehow randomly chooses the picture it displays as thumb for the album (or possible it uses the last modified picture). My question would be if you guys could give me a hint where to start if I want to modify this behaviour to have it display the defined album thumbnail?

Thanks and regards, Robert
Title: Re: Change lastalb function to display album thumbnail?
Post by: Nibbler on July 26, 2007, 08:42:45 am
Take a look at the 'lastalb' case in get_pic_data (include/functions.inc.php). Changing the sql query should be enough, but I don't have a test setup.
Title: Re: Change lastalb function to display album thumbnail?
Post by: rap.nospam on July 26, 2007, 09:20:11 am
Hi Nibbler,

Thanks for the prompt reply, that worked.

In case anybody is interested in that modification, I changed the second query (line 1274 in 1.4.10) to:

$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.pid = {$CONFIG['TABLE_ALBUMS']}.thumb AND {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";

The modifications are adding the check for the album thumb in the WHERE clause and removing the GROUP BY clause.

Regards, Robert
Title: Re: Change lastalb function to display album thumbnail?
Post by: fvalka on September 14, 2008, 10:02:45 am
Please note the your modification will only display the album in the lastalb overview if it has a thumbnail set.

I used the following Hack to display the album thumbnail if there is any, if not do as before:

$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' AND {$CONFIG['TABLE_PICTURES']}.pid LIKE IF({$CONFIG['TABLE_ALBUMS']}.thumb=0,'%',{$CONFIG['TABLE_ALBUMS']}.thumb) $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";

Maybe it will help someone.

Tested it on 1.4.19.

Greetings
Fabian
               
Title: Re: Change lastalb function to display album thumbnail?
Post by: shivas on June 28, 2009, 04:19:23 pm
Could someone post the same thing for 1.4.22(stable), because i searched the lines and couldnt find it...
Title: Re: Change lastalb function to display album thumbnail?
Post by: shivas on June 28, 2009, 04:35:35 pm
Thats ok i fixed it! Tested on 1.4.22 aswell and it works.
You can find this on line 1318 in the /include/functions.inc.php
You just add the following code in bold letters
Please note the your modification will only display the album in the lastalb overview if it has a thumbnail set.

I used the following Hack to display the album thumbnail if there is any, if not do as before:

$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' AND {$CONFIG['TABLE_PICTURES']}.pid LIKE IF({$CONFIG['TABLE_ALBUMS']}.thumb=0,'%',{$CONFIG['TABLE_ALBUMS']}.thumb) $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";

Maybe it will help someone.

Tested it on 1.4.19.

Greetings
Fabian
               
Title: Re: Change lastalb function to display album thumbnail?
Post by: Zer0 on September 03, 2011, 03:10:44 pm
Could someone post the same thing for 1.5.16 pls...
Thx