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: [Solved]: album description in last updated albums  (Read 3784 times)

0 Members and 1 Guest are viewing this topic.

Nad_F

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
[Solved]: album description in last updated albums
« on: November 13, 2006, 04:29:20 pm »

Hello!
Answer me please, can I show album description in last updated albums (lastalb) block?
Beforehand many thanks!
« Last Edit: August 28, 2009, 10:15:30 am by Joachim Müller »
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: album description in last updated albums
« Reply #1 on: November 13, 2006, 04:57:46 pm »

Try reading this thread
http://forum.coppermine-gallery.net/index.php?topic=35188.0

Not sure if solves your problem but it might point you in the right direction.

Cheers!
Hein
Logged

darkheartagram

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: album description in last updated albums
« Reply #2 on: August 28, 2009, 12:47:43 am »

Yeah I know It's old topic but I thing I have solution
Code: [Select]
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
        global $CONFIG, $AUTHORIZED;
        global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units;

        $thumb_per_page = $thumbcols * $thumbrows;
        $lower_limit = ($page-1) * $thumb_per_page;
$album_desc = get_album_desc($_GET[album]);

        $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);

        $total_pages = ceil($thumb_count / $thumb_per_page);

        $i = 0;
        if (count($pic_data) > 0) {
                foreach ($pic_data as $key => $row) {
                        $i++;
$album_desc = get_album_desc($_GET[album]);
                        $pic_title =$album_desc.
$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 = cpg_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(urldecode($pic_url));
                                $row['pwidth'] = $image_info[0];
                                $row['pheight'] = $image_info[1];
                        }

                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
                        $thumb_list[$i]['pid'] = $row['pid'];
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
                        $thumb_list[$i]['caption'] = get_album_desc($_GET[album]);
                        $thumb_list[$i]['admin_menu'] = '';
                        $thumb_list[$i]['aid'] = $row['aid'];
                }
                theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs);
        } else {
                theme_no_img_to_display($album_name);
        }
}

There is only one problem, it show album description when I watching thumbnails in album, In lastalb I got only "Album not found" I thing it's short way to modify it to get album descriprion instead of title and date ( I don't need it ) but any idea what to change in script above?
Logged

darkheartagram

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: album description in last updated albums
« Reply #3 on: August 28, 2009, 02:53:08 am »

Ok I've got solution right here
Code: [Select]
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
        global $CONFIG, $AUTHORIZED;
        global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units;

        $thumb_per_page = $thumbcols * $thumbrows;
        $lower_limit = ($page-1) * $thumb_per_page;
$album_desc = get_album_desc($_GET[album]);

        $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);

        $total_pages = ceil($thumb_count / $thumb_per_page);

        $i = 0;
        if (count($pic_data) > 0) {
                foreach ($pic_data as $key => $row) {
                        $i++;
$album_desc = get_album_desc($_GET[album]);
                        $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 = cpg_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(urldecode($pic_url));
                                $row['pwidth'] = $image_info[0];
                                $row['pheight'] = $image_info[1];
                        }

                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
                        $thumb_list[$i]['pid'] = $row['pid'];
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image2\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
                        if ($album == 'lastalb'){if (get_album_desc($row['aid'])) {$thumb_list[$i]['caption'] = "<div style=\"width:{$image_size['geo3']}px; border-left:1px solid #9e9e9e; border-right:1px solid #9e9e9e; border-bottom:1px solid #9e9e9e;\">".bb_decode(get_album_desc($row['aid']))."</div>";}} else {$thumb_list[$i]['caption'] = bb_decode($row['caption_text']);}
                        $thumb_list[$i]['admin_menu'] = '';
                        $thumb_list[$i]['aid'] = $row['aid'];
                }
                theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs);
        } else {
                theme_no_img_to_display($album_name);
        }
}
some style added
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 15 queries.