I want to skip the thumbnails.php i found a solution for an older version of coppermine
QuoteCopy 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
There's a config setting in cpg1.5.x that you just need to enable to achieve your goal.
Thank you for the quick reply, i found another solution trugh a pluggin
it's called enlargeit and that works great!
Cheers Eddie Hillegers
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
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
if (is_array($alb_list)) {
and above, add
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
'{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
and replace with
'{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.
Andre u r amaaaaaaaaaaaaaaazing it worked thnx a lot and i'm sorry again for the duplicated topics.
Thank u :)
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 :)
Expecting unmodified functions, find
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
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']}&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;
}
}
}
U r the best :)
Thank you.
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.. :-\ ...
Quote from: RainRiku on November 25, 2011, 01:03:03 AM
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
$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
$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']}&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
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
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'];
}
GoodDay!!..
Whoah!!
I'll try this..thanks Αndré.. ;D..
GoodDay..
Thanks Αndré!! It really works..I appreciate this.. ;)