Hello Andre,
Thanks for your help. I need some clarification, though. I have found four instances of the line of code you mention. Do I have to replace it in all of them?
1)
if ($cat['details']['thumb'] > 0) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE pid = {$cat['details']['thumb']} $FORBIDDEN_SET";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$picture = mysql_fetch_assoc($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
2)
if (mysql_num_rows($result)) {
$picture = mysql_fetch_assoc($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
3)
$keyword = ($alb_thumb['keyword'] ? "OR (keywords like '%".addslashes($alb_thumb['keyword'])."%' $forbidden_set_string )" : '');
if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
if ($count > 0 || !empty($alb_stats[$alb_idx]['link_pic_count'])) {
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 {
$picture = $last_pid_data[$alb_stat['last_pid']];
}
$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];
}
4)
$keyword = ($album['keyword'] ? "OR (keywords like '%".addslashes($album['keyword'])."%' $forbidden_set_string)" : '');
if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) { //test for visibility
if ($album['pic_count'] > 0 || !empty($album['link_pic_count'])) {
if (!empty($last_pid_data[$album['thumb']]['filename'])) {
$picture = $last_pid_data[$album['thumb']];
} elseif ($album['thumb'] < 0) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
. "FROM {$CONFIG['TABLE_PICTURES']} WHERE ((aid = '$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 {
$picture = $last_pid_data[$album['last_pid']];
}
$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];
}
Also, I notice that
mysql_free_result($result);
is above
$pic_url = get_pic_url($picture, 'thumb');
in all cases.
What do you mean by your last instruction?
Thanks a lot