Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Album thumbnail in lastalb  (Read 13618 times)

0 Members and 1 Guest are viewing this topic.

phl

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Album thumbnail in lastalb
« 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
« Last Edit: January 30, 2006, 08:36:54 pm by GauGau »
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastcom
« Reply #1 on: March 11, 2005, 03:55:41 pm »

functions.inc.php, find the function display_thumbnails, scroll down to

Code: [Select]
$pic_url =  get_pic_url($row, 'thumb');
and add before it

Code: [Select]
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);
}
« Last Edit: March 11, 2005, 04:16:28 pm by Nibbler »
Logged

phl

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Album thumbnail in lastcom
« Reply #2 on: March 11, 2005, 04:15:13 pm »

mhmm here is the code
Code: [Select]
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  :-\\
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastcom
« Reply #3 on: March 11, 2005, 04:19:47 pm »

Sorry, edited the db query call. I haven't tested it with 1.3.2, but can you post a link to your site ?
Logged

phl

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Album thumbnail in lastcom
« Reply #4 on: March 11, 2005, 04:20:48 pm »

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
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastcom
« Reply #5 on: March 11, 2005, 04:24:22 pm »

What picture are you expecting to see ? As far as I can tell you haven't actually selected an album thumbnail for that album.
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastcom
« Reply #6 on: March 11, 2005, 04:30:19 pm »

Derniers albums mis en ligne = last updated album right ?

So you mean lastalb and not lastcom. (lastcom = last comments)

Change the code posted to:

Code: [Select]
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);
    }
}
Logged

phl

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Album thumbnail in lastcom
« Reply #7 on: March 11, 2005, 04:31:07 pm »

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 ::)
Logged

phl

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Album thumbnail in lastcom
« Reply #8 on: March 11, 2005, 04:36:21 pm »

It works well ;D

Thank you and sorry for my mistake ;)
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastcom
« Reply #9 on: March 11, 2005, 04:38:20 pm »

No problem. I've corrected the thread title to avoid confusion.
Logged

Juanito

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: Album thumbnail in lastalb
« Reply #10 on: April 26, 2005, 08:14:53 pm »

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!

Code: [Select]
                       $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];
                        }
Logged

Juanito

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: Album thumbnail in lastalb
« Reply #11 on: April 26, 2005, 08:20:43 pm »

sorry for the previous post! it does work. but it doesnt seem to work when i set the album thumbnail to "Last Uploaded"
Logged

Nibbler

  • Guest
Re: Album thumbnail in lastalb
« Reply #12 on: April 27, 2005, 09:02:54 am »

That's correct.
Logged

kper

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Album thumbnail in lastalb
« Reply #13 on: May 14, 2005, 02:13:15 pm »


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?

Logged

kper

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Album thumbnail in lastalb
« Reply #14 on: May 16, 2005, 08:17:42 pm »

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

Logged

kper

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Album thumbnail in lastalb
« Reply #15 on: May 17, 2005, 10:04:27 am »

 ::) 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
Code: [Select]
$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
not before
Code: [Select]
$pic_url =  get_pic_url($row, 'thumb');


Logged

hasemann

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 44
Re: Album thumbnail in lastalb
« Reply #16 on: December 05, 2005, 11:14:59 pm »

Any ideas how this hack would work with Coppermine 1.4.2 ???
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Album thumbnail in lastalb
« Reply #17 on: January 30, 2006, 07:56:57 pm »

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

Nibbler

  • Guest
Re: Album thumbnail in lastalb
« Reply #18 on: January 30, 2006, 07:59:27 pm »

Use cpg_db_query instead of db_query.
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Album thumbnail in lastalb
« Reply #19 on: January 30, 2006, 08:06:43 pm »

perfect. its working. thanks!!!
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.