16
Mods & Plugins (Requests & Discussions) / Re: [Request] Show user images in profile
« on: September 25, 2006, 03:29:31 AM »
i use this code
not the best
Code: [Select]
///////// Start Show member photos /////////////////
$imagesperpage = 12;
$sql = "SELECT COUNT(user_id) AS images
FROM ".IMAGES_TABLE."
WHERE user_id = ".$user_id;
$result = $site_db->query_firstrow($sql);
$num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $imagesperpage, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$sql = "SELECT i.image_id, i.cat_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".$additional_sql.", c.cat_name
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
WHERE i.image_active = 1 AND i.user_id = ".$user_row['user_id']." AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
ORDER BY i.image_date DESC
LIMIT $offset, $imagesperpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$last_images = "<tr class=\"row1\"><td>";
$last_images .= "Keine Bilder von diesem Benutzer vorhanden";
$last_images .= "</td></tr>";
}
else {
$last_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
$last_images = "";
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$last_images .= "<tr class=\"row1\">\n";
}
$last_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$last_images .= $site_template->parse_template("thumbnail_bit");
$last_images .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$last_images .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$last_images .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$last_images .= "</tr>\n";
}
}
// $last_images .= "</table>\n";
} // end else
///////// End Show member photos /////////////////
not the best