Thanks for the good job. I changed some of those codes and found a (maybe) better way.
I want to show all the urls with normal size link, if there is not a normal file, shows the fullsize picture. It is quite useful when you want to show some photos in a forum.
You can change this piece of code:
$my_gallery_id = FIRST_USER_CAT + USER_ID;
if ((GALLERY_ADMIN_MODE) || ($my_gallery_id == $cat)) {
$sql = "SELECT filepath, filename " .
" FROM {$CONFIG['TABLE_PICTURES']} " .
" WHERE aid = $aid";
$pics_q = cpg_db_query($sql);
$pics = cpg_db_fetch_rowset($pics_q);
mysql_free_result($pics_q);
foreach ( $pics as $pict) {
$album_url_final .= "[url=$CONFIG[ecards_more_pic_target]albums/$pict[filepath]$pict[filename]][img]$CONFIG[ecards_more_pic_target]albums/$pict[filepath]thumb_$pict[filename][/img][/url] ";
}
}
with mine new one:
$my_gallery_id = FIRST_USER_CAT + USER_ID;
if ((GALLERY_ADMIN_MODE) || ($my_gallery_id == $cat)) {
$sql = "SELECT filepath, filename, pheight, pwidth" .
" FROM {$CONFIG['TABLE_PICTURES']} " .
" WHERE aid = $aid";
$pics_q = cpg_db_query($sql);
$pics = cpg_db_fetch_rowset($pics_q);
mysql_free_result($pics_q);
foreach ($pics as $pict) {
$fullurl = "{$CONFIG['ecards_more_pic_target']}albums/".get_pic_url($pict, 'fullsize');
$normalurl = "{$CONFIG['ecards_more_pic_target']}albums/".get_pic_url($pict, 'normal');
$urlarray = array($fullurl,$normalurl);
$condition = true;
if($CONFIG['thumb_use']=='ht' && $pict['pheight'] > $CONFIG['picture_width'] ){
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $pict['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($pict['pwidth'], $pict['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CONFIG['make_intermediate'] && $condition) {
$album_url_final .= nl2br("[url=$urlarray[0]][img]$urlarray[1][/img][/url] \n");
} else {
$album_url_final .= nl2br("[url=$urlarray[0]][img]$urlarray[0][/img][/url] \n");
}
}
It does:
1. Compare the $CONFIG['picture_width'] with the pictures's size, and decide if there is a normal-size file or not.
2. If there is a normal-size file, show the url, otherwise show the full-size file' url. (you can change this as you need)
3. add a "\n" code every line of the url list, and put php to prase it into "<br />". (you can change this either)
It works at my CPG, but use it at your risk.
To say it again, my english is so poor
