yep, you are right. with the complete code it works, but there comes up a new error, when i embedd the tag in the template file, a thumbnail shows up, but also a little bit of code.
this is the the rating code in top.php:
// Rating
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.", "user_name").", i.image_thumb_file
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 i.cat_id = c.cat_id
$cat_match_sql
ORDER BY i.image_rating DESC, i.image_name ASC
LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
$top_list[$i] = $row;
$i++;
}
$site_db->free_result();
for ($i = 1; $i <= 10; $i++) {
if (isset($top_list[$i])) {
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
$register_array['image_rating_thumb_'.$i] = (isset($top_list[$i]['image_id']) && !empty($top_list[$i]['image_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\"><img src=\"data/thumbnails/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file']."\" width=\"48\" height=\"36\" border=\"0\" alt=\"\" />" . $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text(trim($top_list[$i]['image_name']), 2)."</a>" : format_text(trim($top_list[$i]['image_name']), 2);
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$top_list[$i]['user_id'];
$register_array['image_rating_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
}
else {
$register_array['image_rating_user_'.$i] = $lang['userlevel_guest'];
}
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
$register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
}
else {
$register_array['image_rating_'.$i] = "--";
$register_array['image_rating_user_'.$i] = "--";
$register_array['image_rating_cat_'.$i] = "--";
$register_array['image_rating_number_'.$i] = "--";
$register_array['image_rating_thumb_'.$i] = "--";
}
}
and after the thumbnail at the front end it shows this: ./details.php?image_id=719">(name of the file)