whatever is works for you. for some people is easier remove few categories from the list for others is easier to use only few specific categories...
right
anyway, as Хyu BAM said in her(?) last reply, the only line should be changed is in this block:
it's not working, same situation. e.g.: i have 10 categories and with this example it works for the categories 1-3, but the most time (7/10) there is no random-image (empty).
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id AND i.cat_id IN (".implode(", ", $cat_in).")
LIMIT $number, 1";
$random_image_cache[0] = $site_db->query_firstrow($sql);
maybe i'm wrong, but what's up with the variable "$number"?
this $number is generated of the total-images. but the value of total-images is lower in combination of filtered categories.
so if i do following and it works good, maybe there is a better solution:
find:
mt_srand((double)microtime() * 1000000);
insert before:
$sql = "SELECT COUNT(*) as total_images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql) AND cat_id IN (".implode(", ", $cat_in).")";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];
this will calculate the real total_images for the filtered random-images.
it was just a test so i hope this will help to solve this problem with a better solution instead this one
G.