$maxwidth) $fac = min($fac, $maxwidth / $origsize[0]); if($origsize[1] > $maxheight) $fac = min($fac, $maxheight / $origsize[1]); $newwidth = $origsize[0] * $fac; $newheight = $origsize[1] * $fac; $origpic = imagecreatefromjpeg($orig_filename); $newpic = @imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($newpic, $origpic, 0, 0, 0, 0, $newwidth, $newheight, $origsize[0], $origsize[1]); imagejpeg($newpic, $normal_filename, $quality); return true; } if(!$_REQUEST['cat']) die('cat?'); if(!($MYSQL_LINK = mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass'])) || !mysql_select_db($CONFIG['dbname'], $MYSQL_LINK)) die("No database connection!"); list($max) = mysql_fetch_array(mysql_query("SELECT count(*) FROM {$CONFIG[TABLE_PREFIX]}pictures WHERE aid = $_REQUEST[cat] and user1 = '1'")); $pic_no = $_REQUEST['i']; do { if(!$pic_no) $pic_no = mt_rand(0, $max - 1); list($pic_id, $pic_filepath, $pic_filename) = mysql_fetch_array(mysql_query("SELECT pid, filepath, filename FROM {$CONFIG[TABLE_PREFIX]}pictures WHERE aid = $_REQUEST[cat] and user1 = '1' limit $pic_no, 1")); if(check($pic_filepath, $pic_filename)) break; $pic_no = 0; } while (1); do { $nextpic_no = mt_rand(0, $max - 1); list($nextpic_id, $nextpic_filepath, $nextpic_filename) = mysql_fetch_array(mysql_query("SELECT pid, filepath, filename FROM {$CONFIG[TABLE_PREFIX]}pictures WHERE aid = $_REQUEST[cat] and user1 = '1' limit $nextpic_no, 1")); } while (!check($nextpic_filepath, $nextpic_filename)); ?> "> cellspacing=0 cellpadding=0>
cellspacing=0 cellpadding=0>
" : "" ?>" border=0 >" : "" ?> " width=1 style="visibility:hidden">