Change lastalb function to display album thumbnail? Change lastalb function to display album thumbnail?
 

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

Main Menu

Change lastalb function to display album thumbnail?

Started by rap.nospam, July 26, 2007, 08:39:56 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

rap.nospam

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

Nibbler

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.

rap.nospam

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

fvalka

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
               

shivas

Could someone post the same thing for 1.4.22(stable), because i searched the lines and couldnt find it...
Get on your Dancing shoes!

shivas

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
Quote from: 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
               
Get on your Dancing shoes!

Zer0

Could someone post the same thing for 1.5.16 pls...
Thx