1
Mods & Plugins (Releases & Support) / Re: [Mod] Random image / Zufallsbild
« on: November 29, 2006, 08:32:39 PM »
Vielen Dank! Es funktioniert tatsächlich Freue mich, wie gut die Hilfe hier funktioniert
Gruß
Gruß
4images code on GitHub Click here to visit GitHub.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
/*
MOD LAST COMMENTS
START INSERT
*/
//Settings
$num = 15; //how many comments to show
$thumb_size = 48; //max dim of thumbnails in pixels
$text_len = 250; //max lenght of the text to show (bbcode and html are counted too)
//End settings
$last_comments = "<table>";
$sql = "SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file".get_user_table_field(", u.", "user_name")." as user_name".get_user_table_field(", s.", "user_name")." as comment_user_name
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
LEFT JOIN ".USERS_TABLE." u ON ".get_user_table_field("u.", "user_id")." = i.user_id
LEFT JOIN ".USERS_TABLE." s ON ".get_user_table_field("s.", "user_id")." = c.user_id
WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN (".get_auth_cat_sql('auth_readcomment', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewcat', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewimage', 'NOTIN').")
ORDER BY c.comment_date DESC
LIMIT ".$num;
$result = $site_db->query($sql);
$bgcounter = 0;
while ($row = $site_db->fetch_array($result))
{
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
if (empty($row['image_thumb_file']))
{
$thumb_file = ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
}
else
{
$thumb_file = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$row['cat_id']."/".$row['image_thumb_file'];
}
$thumb_info = @getimagesize($thumb_file);
$width = ($thumb_info[0]) ? $thumb_info[0] : $thumb_size;
$height = ($thumb_info[1]) ? $thumb_info[1] : $thumb_size;
if ($width > $thumb_size && $height > $thumb_size)
{
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $thumb_size;
$new_height = round(($thumb_size/$width) * $height);
}else {
$new_width = round(($thumb_size/$height) * $width);
$new_height = $thumb_size;
}
}
else
{
$new_width = $width;
$new_height = $height;
}
$view_image = true;
$thumb = "<img src=\"".$thumb_file."\" class=\"small_image\" onmouseover=\"showTooltip('lctt_".$row['image_id']."')\" onmouseout=\"hideTooltip()\" border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
/*
$view_image = check_permission('auth_viewcat', $row['cat_id']);
$thumb = "<img src=\"".$thumb_file."\"".(($view_image) ? "" : " onClick=\"alert('".(($lang['auth_alert'][$cat_id]) ? $lang['auth_alert'][$cat_id] : $lang['auth_alert']['default'])."');\"")." border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
*/
$image_user_name = ($row['user_id'] != GUEST) ? $row['user_name'] : $lang['userlevel_guest'];
$image_user_link = ($row['user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id']) : "";
$comment_user_name = ($row['comment_user_id'] == GUEST) ? ((empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : $row['guest_user_name']) : $row['comment_user_name'];
$comment_user_link = ($row['comment_user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['comment_user_id']) : "";
$text = $row['comment_text'];
if (strlen($text) > $text_len) {
$text = substr($text, 0, $text_len)." ...";
}
$site_template->register_vars(array(
"last_comments_more" => "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments", "&")."\">".$lang['last_comments_more']."</a>",
"comment_image" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$row['image_id'])."\">".$thumb."</a>" : $thumb,
"comment_guest" => ($row['comment_user_id'] == GUEST && !empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : "",
"comment_image_name" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".stripslashes($row['image_name'])."</a>" : stripslashes($row['image_name']),
"image_cat_name" => (check_permission('auth_viewcat', $row['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\">".$cat_cache[$row['cat_id']]['cat_name']."</a>" : $cat_cache[$row['cat_id']]['cat_name'],
"image_user_name" => ($image_user_link) ? "<a href=\"".$image_user_link."\">".$image_user_name."</a>" : $image_user_name,
"comment_user_name" => ($comment_user_link) ? "<a href=\"".$comment_user_link."\">".$comment_user_name."</a>" : $comment_user_name,
"comment_user_id" => $row['comment_user_id'],
"comment_headline" => format_text($row['comment_headline'], 0, $config['wordwrap_comments'], $config['bb_comments'], 0, 1),
"comment_text" => format_text($text, $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'], 1, 0),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $row['comment_date']),
"row_bg_number" => $row_bg_number,
"comment_image_id" => $row['image_id']
));
$last_comments .= $site_template->parse_template("last_comment_bit");
}
$last_comments .= "</table>";
/*
if (empty($last_comments))
{
$last_comments = $lang['no_comments'];
}
*/
$site_template->register_vars(array(
"lang_last_comments" => $lang['last_comments'],
"last_comments" => $last_comments
));
/*
MOD LAST COMMENTS
END INSERT
*/
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', 'galerie/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
$sql = "SELECT COUNT(*) as total_images
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo "<div style=\"float: left; background-color:#d3ca91;padding:1px\"><a href=\"".ROOT_PATH."img".$image_id.".htm\"><img src=\"".$thumb_src."\" border=\"0\" style=\"border: 6px solid white;\" alt=\"".$image_name."\" /></a></div><br style=\"clear:both;\"/>\n<br />\n";
echo "<b>".$image_name."</b><br />\n";
echo "Kommentare: ".$image_comments."<br />\n";
?>
i`m trying to display the category and not only the image name
i was able to add the info needed in the xml file but the problem is that it`s in non latin characters and they are not displayed correclty in the flash movie...
any tips ??
Hi Konrad,
are you able to give me you superb Flashshow Version in German?
{header}
<h2>Kategorien</h2>
{categories_list}
</div><!-- divID left -->
<div id="content">
<h2>{site_name}</h2>
<br />
<div class="kasten">
<div>
{if stats_overview}
<h3>{lang_langstats_overview}</h3>
<table width="100%" border="0" cellspacing="3" cellpadding="3" class="row2">
{stats_overview}
</table>
<br />
{endif stats_overview}
<table width="100%">
<tr>
<td width="50%">
{if stats_user_stats}
{lang_langstats_userstats}
{stats_user_stats}
{endif stats_user_stats}
{if stats_commentstats}
{stats_commentstats}
{endif stats_commentstats}
{if stats_topuploaders}
{stats_topuploaders}
{endif stats_topuploaders}
{if stats_topusersnewusers}
{stats_topusersnewusers}
{endif stats_topusersnewusers}
{if stats_toppostcardssenduser}
{stats_toppostcardssenduser}
{endif stats_toppostcardssenduser}
{if stats_topimagehitsfromuser}
{stats_topimagehitsfromuser}
{endif stats_topimagehitsfromuser}
{if stats_topimagevoter}
{stats_topimagevoter}
{endif stats_topimagevoter}
{if stats_topusersshouted}
{stats_topusersshouted}
{endif stats_topusersshouted}
{if stats_topuserslastaction}
{stats_topuserslastaction}
{endif stats_topuserslastaction}
<br />
<br />
</td>
<td width="50%">
{if stats_votestats}
{stats_votestats}
{endif stats_votestats}
{if stats_topagegroups}
{lang_langstats_topagegroups}
{stats_topagegroups}
{endif stats_topagegroups}
{if stats_imagestats}
{stats_imagestats}
{endif stats_imagestats}
{if stats_topdownloaders}
{stats_topdownloaders}
{endif stats_topdownloaders}
{if stats_topcommenter}
{stats_topcommenter}
{endif stats_topcommenter}
{if stats_toppostcardsfromuser}
{stats_toppostcardsfromuser}
{endif stats_toppostcardsfromuser}
{if stats_topimageratingsfromuser}
{stats_topimageratingsfromuser}
{endif stats_topimageratingsfromuser}
{if stats_topimagevotedfromuser}
{stats_topimagevotedfromuser}
{endif stats_topimagevotedfromuser}
{if stats_topusersprofilehits}
{stats_topusersprofilehits}
{endif stats_topusersprofilehits}
{if stats_topcommented}
{stats_topcommented}
{endif stats_topcommented}
</td>
</tr>
</table>
<br />
<br />
<div align="center">Statistics {stats_version} by IcEcReaM</div>
<!-- Please don't remove the copyright -->
<!-- Statistics v1.0 (c)2006 by IcEcReaM -->
</div>
</div>
{copyright}
<br />
</div> <!-- DivID content -->
<div id="right">
{footer}
{header}
<h2>Kategorien</h2>
{categories_list}
</div><!-- divID left -->
<div id="content">
<h2>{site_name}</h2>
<br />
<div class="kasten">
<div>
{if stats_overview}
<h3>{lang_langstats_overview}</h3>
<table width="100%" border="0" cellspacing="3" cellpadding="3" class="row2">
{stats_overview}
</table>
<br />
{endif stats_overview}
<table width="100%">
<tr>
<td width="50%">
{if stats_user_stats}
{lang_langstats_userstats}
{stats_user_stats}
{endif stats_user_stats}
{if stats_commentstats}
{stats_commentstats}
{endif stats_commentstats}
{if stats_topuploaders}
{stats_topuploaders}
{endif stats_topuploaders}
{if stats_topusersnewusers}
{stats_topusersnewusers}
{endif stats_topusersnewusers}
{if stats_toppostcardssenduser}
{stats_toppostcardssenduser}
{endif stats_toppostcardssenduser}
{if stats_topimagehitsfromuser}
{stats_topimagehitsfromuser}
{endif stats_topimagehitsfromuser}
{if stats_topimagevoter}
{stats_topimagevoter}
{endif stats_topimagevoter}
{if stats_topusersshouted}
{stats_topusersshouted}
{endif stats_topusersshouted}
{if stats_topuserslastaction}
{stats_topuserslastaction}
{endif stats_topuserslastaction}
<br />
<br />
</td>
<td width="50%">
{if stats_votestats}
{stats_votestats}
{endif stats_votestats}
{if stats_topagegroups}
{lang_langstats_topagegroups}
{stats_topagegroups}
{endif stats_topagegroups}
{if stats_imagestats}
{stats_imagestats}
{endif stats_imagestats}
{if stats_topdownloaders}
{stats_topdownloaders}
{endif stats_topdownloaders}
{if stats_topcommenter}
{stats_topcommenter}
{endif stats_topcommenter}
{if stats_toppostcardsfromuser}
{stats_toppostcardsfromuser}
{endif stats_toppostcardsfromuser}
{if stats_topimageratingsfromuser}
{stats_topimageratingsfromuser}
{endif stats_topimageratingsfromuser}
{if stats_topimagevotedfromuser}
{stats_topimagevotedfromuser}
{endif stats_topimagevotedfromuser}
{if stats_topusersprofilehits}
{stats_topusersprofilehits}
{endif stats_topusersprofilehits}
{if stats_topcommented}
{stats_topcommented}
{endif stats_topcommented}
</td>
</tr>
</table>
<br />
<br />
<div align="center">Statistics {stats_version} by IcEcReaM</div>
<!-- Please don't remove the copyright -->
<!-- Statistics v1.0 (c)2006 by IcEcReaM -->
</div>
</div>
{copyright}
<br />
</div> <!-- DivID content -->
<div id="right">
{footer}