<?php // $Id: block-Random_Userphoto.php,v 1.1 2004/03/11 23:58:16 EllselAn Exp $
/**********************************************************************/
/* pragmaMx 0.2 / Mx 2.2  Content Management System Platform          */
/* ================================================================== */
/* Copyright (C) 2004 by the vkpMx & pragmaMx Developer Team          */
/* email:        team@pragmamx.org                                    */
/* homepage:     http://www.maax-design.de & http://www.pragmaMx.org  */
/* ================================================================== */
/*   The vkpMx is distributed free of charge by maax-design.de.       */
/*   The use of this system is allowed until copyright information    */
/*   is shown perspicuous visible and correcty on all system pages.   */
/*   Sales, rent out and the use of single code parts from this       */
/*   system must be allowed by maax-design.de.                        */
/**********************************************************************/
if (!defined("mxMainFileLoaded")) die ("You can't access this file directly...");

//////////////////////////////////////////
// Blockcache erlauben?
$mxblockcache = TRUE;
// Pfad zu den Bildern
$imagedir = 'images/forum/member_avatar/';
// maximale Breite des Bildes
$maxwidth = 120;
//////////////////////////////////////////

$imglist = array();
$imgs = dir($imagedir);
while ($file = $imgs -> read()) {
	if (preg_match('#(.*)([0-9])(\.gif|\.jpe?g)$#i', $file, $matches)) {
		$imglist[] = $matches;
		}
	}
closedir($imgs->handle);

if (count($imglist)) {
	srand ((float)microtime()*1000000);
	shuffle($imglist);
	$size = getimagesize($imagedir.'/'.$imglist[0][0]);
	$size = ($size[0] > $maxwidth) ? 'width="120"' : $size[3];

	$content = '
	<center>
	<img src="'.$imagedir.'/'.$imglist[0][0].'" '.$size.' border="0" alt="'.$imglist[0][1].'"><br>
	<a href="modules.php?name=Userinfo&amp;uname='.$imglist[1][1].'"><b>'.$imglist[1][1].'</b></a>
	</center>';
	}

?>