forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: eddieh on January 21, 2011, 02:54:47 pm

Title: Skipping thumbnails.php and go directly to displayimage.php
Post by: eddieh on January 21, 2011, 02:54:47 pm
I want to skip the thumbnails.php i found a solution for an older version of coppermine

Quote
Copy the functions theme_display_album_list() and theme_display_album_list_cat() from the sample theme.php into your custom theme.php and change

Code:

'{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",


to

Code:

'{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&pos=0",


in both the functions.

But 1.5X now works a bit different. It uses &pid= to call the displayimage.php page.
I spend all day trying to figure it out but i cannot get it to work. I hope somebody can help me out

Thanks in advance

Eddie Hillegers

Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: Αndré on January 21, 2011, 03:40:48 pm
There's a config setting in cpg1.5.x that you just need to enable to achieve your goal.
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: eddieh on January 23, 2011, 02:12:07 pm
Thank you for the quick reply, i found another solution trugh a pluggin
it's called enlargeit and that works great!


Cheers Eddie Hillegers
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: try911 on July 21, 2011, 11:52:15 am
Could u tell me how did you skip thumbnails.php using enlargeit plugin or any other approche in details because i am facing the same problem??
Thnx
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: Αndré on July 21, 2011, 04:04:06 pm
cpg1.4.x tutorial here: http://forum.coppermine-gallery.net/index.php/topic,50328.msg242314.html#msg242314


In cpg1.5.x you have to do the following.

Copy the functions theme_display_album_list and theme_display_album_list_cat from themes/sample/theme.php into your theme's theme.php file if they don't exist. Then, find
Code: [Select]
if (is_array($alb_list)) {and above, add
Code: [Select]
    global $USER;

    $sort_array = array(
        'na' => "filename $ASC, pid $ASC",
        'nd' => "filename $DESC, pid $DESC",
        'ta' => "title $ASC, pid $ASC",
        'td' => "title $DESC, pid $DESC",
        'da' => "pid $ASC",
        'dd' => "pid $DESC",
        'pa' => "position $ASC, pid $ASC",
        'pd' => "position $DESC, pid $DESC",
    );

    $sort_code  = isset($USER['sort'])? $USER['sort'] : $CONFIG['default_sort_order'];
    $sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$CONFIG['default_sort_order']];

find
Code: [Select]
'{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",and replace with
Code: [Select]
'{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&pid=".mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$album['aid']}' ORDER BY {$sort_order} LIMIT 1"), 0),
in both the functions.
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: try911 on July 21, 2011, 06:03:56 pm
Andre u r amaaaaaaaaaaaaaaazing it worked thnx a lot and i'm sorry again for the duplicated topics.
Thank u :)
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: try911 on July 25, 2011, 10:04:40 am
Hello Andre i have one last question plz.
I want the same pic on the thumbnail appear in the displayimage.php not any picture, So what should i do??
Thanx a lot :)
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: Αndré on July 25, 2011, 11:00:43 am
Expecting unmodified functions, find
Code: [Select]
    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                '{ALB_HITS}' => $album['alb_hits'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }
and replace with
Code: [Select]
    global $USER;

    $sort_array = array(
        'na' => "filename $ASC, pid $ASC",
        'nd' => "filename $DESC, pid $DESC",
        'ta' => "title $ASC, pid $ASC",
        'td' => "title $DESC, pid $DESC",
        'da' => "pid $ASC",
        'dd' => "pid $DESC",
        'pa' => "position $ASC, pid $ASC",
        'pd' => "position $DESC, pid $DESC",
    );

    $sort_code  = isset($USER['sort'])? $USER['sort'] : $CONFIG['default_sort_order'];
    $sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$CONFIG['default_sort_order']];

    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $pid = mysql_result(cpg_db_query("SELECT thumb FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '{$album['aid']}' LIMIT 1"), 0);
            if ($pid < 1) {
                $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$album['aid']}' ORDER BY {$sort_order} LIMIT 1"), 0);
            }

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&amp;pid={$pid}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                '{ALB_HITS}' => $album['alb_hits'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: try911 on July 26, 2011, 10:19:34 am
U r the best :)
Thank you.
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: RainRiku on November 25, 2011, 01:03:03 am
Hi Αndré,

            Thanks for this...

            I tried your code, it works if you have a specified an Album Thumbnail..but if random thumbnail it will display the first picture of the album..  :-\ ...
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: Αndré on November 25, 2011, 04:38:23 pm
if random thumbnail it will display the first picture of the album

To display always the file which has been used as album thumbnail, change the code the following way.


Expecting unmodified functions (mentioned above), find
Code: [Select]
            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                '{ALB_HITS}' => $album['alb_hits'],
                );
and replace with
Code: [Select]
            $pid = mysql_result(cpg_db_query("SELECT thumb FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '{$album['aid']}' LIMIT 1"), 0);
            if ($pid < 1) {
                $pid = $album['thumb_pid'];
            }

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&amp;pid={$pid}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                '{ALB_HITS}' => $album['alb_hits'],
                );


Additionally, you have to modify index.php. Find
Code: [Select]
                if (!empty($alb_thumb['filename'])) {
                    $picture = &$alb_thumb;
                } elseif ($alb_thumb['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} "
                        . "WHERE ((aid = '{$alb_thumb['aid']}' $forbidden_set_string) $keyword) $approved "
                        . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                } else {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='{$alb_stat['last_pid']}'";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                }

                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                //$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
                if (array_key_exists('system_icon', $picture) && ($picture['system_icon'] == true)) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }

                $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />";
and replace with
Code: [Select]
                if (!empty($alb_thumb['filename'])) {
                    $picture = &$alb_thumb;
                } elseif ($alb_thumb['thumb'] < 0) {
                    $sql = "SELECT pid, filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} "
                        . "WHERE ((aid = '{$alb_thumb['aid']}' $forbidden_set_string) $keyword) $approved "
                        . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                } else {
                    $sql = "SELECT pid, filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='{$alb_stat['last_pid']}'";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                }

                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                //$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
                if (array_key_exists('system_icon', $picture) && ($picture['system_icon'] == true)) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }

                $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />";
                if ($picture['pid']) {
                    $alb_list[$alb_idx]['thumb_pid'] = $picture['pid'];
                }
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: RainRiku on November 28, 2011, 12:25:54 am
GoodDay!!..

Whoah!!

I'll try this..thanks Αndré.. ;D..
Title: Re: Skipping thumbnails.php and go directly to displayimage.php
Post by: RainRiku on November 28, 2011, 12:57:12 am
GoodDay..

Thanks Αndré!! It really works..I appreciate this.. ;)