forum.coppermine-gallery.net
Support => Older/other versions => cpg1.3.x Support => Topic started by: phl on March 11, 2005, 03:28:54 pm
-
Hello, I've just added the lastalb case on my CPG 1.3.2 website. I see that the thumbnail which appears on the index page is not the same as the Album thumbnail.
I would like that the thumbnail of the index be the same as the Album thumbnail.
I think I should modify something in include/function.inc.php from line 810 to 834
810 : case 'lastalb': // Last albums to which uploads
...
834 : break;
but I don't know what :-\\
thanks
-
functions.inc.php, find the function display_thumbnails, scroll down to
$pic_url = get_pic_url($row, 'thumb');
and add before it
if ($album == 'lastcom'){
$res = db_query("SELECT p.* FROM {$CONFIG['TABLE_ALBUMS']} AS a,{$CONFIG['TABLE_PICTURES']} AS p WHERE p.pid = a.thumb AND a.aid = {$row['aid']}");
$row2 = mysql_fetch_assoc($res);
$row = array_merge($row, $row2);
}
-
mhmm here is the code
if ($album == 'lastcom'){
$res = db_query("SELECT p.* FROM {$CONFIG['TABLE_ALBUMS']} AS a,{$CONFIG['TABLE_PICTURES']} AS p WHERE p.pid = a.thumb AND a.aid = {$row['aid']}");
$row2 = mysql_fetch_assoc($res);
$row = array_merge($row, $row2);
}
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = getimagesize($pic_url);
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
I replace cpg_db_query by db_query because I got an error with cpg_...
and it doesn't change anything :-\\
-
Sorry, edited the db query call. I haven't tested it with 1.3.2, but can you post a link to your site ?
-
http://www.mxv.be/phl/index.php
for example : the second thumb in Derniers albums mis en ligne is not the same as the album thumb I selected for this album (Barbara - 21 ans).
most of the time the thumb of the index is the first pictures of the album ... but sometimes the last ... strange
-
What picture are you expecting to see ? As far as I can tell you haven't actually selected an album thumbnail for that album.
-
Derniers albums mis en ligne = last updated album right ?
So you mean lastalb and not lastcom. (lastcom = last comments)
Change the code posted to:
if ($album == 'lastalb'){
$res = db_query("SELECT p.* FROM {$CONFIG['TABLE_ALBUMS']} AS a,{$CONFIG['TABLE_PICTURES']} AS p WHERE p.pid = a.thumb AND a.aid = {$row['aid']}");
if (mysql_num_rows($res)){
$row2 = mysql_fetch_assoc($res);
$row = array_merge($row, $row2);
}
}
-
I want that both thumb (the one in lastalb and the one of the album) to be the same.
I selected IMGP0984.JPG for the Barbara - 21 ans album and in lastcom IMGP0959.JPG appears
EDIT : sorry for my mistake (I drank a lot of beers yesterday) I was speaking of lastalb ... yes ::)
-
It works well ;D
Thank you and sorry for my mistake ;)
-
No problem. I've corrected the thread title to avoid confusion.
-
this doesnt seem to wanna work for me. im using 1.3.3. here's how i added the code... am i doing it right? any help is appreciated. thank you!
$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
$lang_display_thumbnails['filesize'].($row['filesize'] >> 10).$lang_byte_units[1]."\n".
$lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
$lang_display_thumbnails['date_added'].localised_date($row['ctime'], $album_date_fmt);
if ($album == 'lastalb'){
$res = db_query("SELECT p.* FROM {$CONFIG['TABLE_ALBUMS']} AS a,{$CONFIG['TABLE_PICTURES']} AS p WHERE p.pid = a.thumb AND a.aid = {$row['aid']}");
if (mysql_num_rows($res)){
$row2 = mysql_fetch_assoc($res);
$row = array_merge($row, $row2);
}
}
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = getimagesize($pic_url);
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
-
sorry for the previous post! it does work. but it doesnt seem to work when i set the album thumbnail to "Last Uploaded"
-
That's correct.
-
It also now shows a different image to the thumbnail when you click!...
ie. the thumbnail is now the correct one to represent the album, but when you click on it, you are shown the image you would have been shown before applying this mod
which, combined with the aforementioned beers can really make your head spin! ;D
What could be the solution?
-
Can anyone shed any light on this? It would be really useful to understand how this works so that I can fix it. At the moment, I don't really understand.
Having applied this hack, the thumbnail picture displayed is the correct one (ie. the one previously chosen to represent the gallery)
but the picture data in the alt tool-tip (eg. size, filename etc.) and the link to the intermediate picture are as if the hack had not been applied!
ie. they remain unchanged
A knowledgeable reply is guaranteed to increase the level of php/mysql understanding in the world and might even contribute in some small way to global peace eg. I am less likely to kick the cat in frustration :o - OK so that is local peace, but there may be knock-on effects...
-
::) Duur! Silly me. The fix is, of course, blindingly obvious, requiring only that one not be asleep.
Zero knowledge and the merest soupcon of understanding necessary!
Just put Nibbler's code before the line
$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
not before
$pic_url = get_pic_url($row, 'thumb');
-
Any ideas how this hack would work with Coppermine 1.4.2 ???
-
yeah, how will this work in 1.4.3. i tried pasting the code and i got an error. can someone look at this please? thanks a lot!
-
Use cpg_db_query instead of db_query.
-
perfect. its working. thanks!!!