Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.

PHP: Warning: Division by zero

Ajax, Hijax, Microformats, RDF, Markup, HTML, PHP, CSS, MySQL, htaccess, robots.txt, CGI, Java, Javascript usw.
Neues Thema Antworten
tango
PostRank 2
PostRank 2
Beiträge: 41
Registriert: 16.04.2006, 19:14
Wohnort: Essen

Beitrag von tango » 26.04.2007, 15:51

Warning: Division by zero in /.../ on line 79
Warning: Division by zero in /.../ on line 80

grrr, warum bekomme ich hier immer Division by zero ???? :roll:



Code: Alles auswählen

global $dbi, $user_prefix;

$allowed_width = 120;
$allowed_height = 120;
$imageborder = 0;
$imagelist = array();
$activenames = array();

$direktory = "images/members";
$handle = opendir ( $direktory );
while ( $file = readdir ( $handle ) ) {
          if ( eregi("\.jpe?g$", $file) || eregi("\.gif$", $file) || eregi("\.png$", $file ) ) {
	           $imagelist[] = $file;
          }
}
closedir($handle);
$result = sql_query ( "SELECT uname FROM ".$user_prefix."_users WHERE user_image_active='1'", $dbi );
$activenames_num = sql_num_rows ( $result, $dbi );


if ( intval ( $activenames_num ) >= 1){
	 $content = "";
	 
	 while ( list ( $active_uname ) = sql_fetch_row ( $result, $dbi ) ) {
		       $activenames[] = $active_uname;
	 }
	 
	 sql_free_result ( $result );
	 
     $random = 0;
     shuffle ( $activenames );
    
    $linktarget = "modules.php?name=Your_Account&op=userinfo&uname=$activenames[$random]";
    $linkname = "".$activenames[$random]."'s Profil";
    $imagedescription = "".$activenames[$random]."'s Bild";

    for &#40; $i = 0; $i < count&#40;$imagelist&#41;; $i++ &#41; &#123;
	       if &#40; eregi &#40; "\.jpeg$", $imagelist&#91;$i&#93; &#41; &#41; &#123;
	            $str_file = 5;
           &#125; else &#123;
	            $str_file = 4;
           &#125;
                
           if &#40; $activenames&#91;$random&#93; == substr &#40; $imagelist&#91;$i&#93;, 0, strlen &#40; $imagelist&#91;$i&#93; &#41;-$str_file &#41; &#41; &#123;
	            $random_member_pic =  $imagelist&#91;$i&#93;;
	            $info = @getimagesize &#40; "images/members/$imagelist&#91;$i&#93;" &#41;;
           &#125; else &#123;
           &#125;
    &#125;
   
    $width = $info&#91;'0'&#93;;
    $height = $info&#91;'1'&#93;;
    $x_ratio = $allowed_width / $width;
    $y_ratio = $allowed_height / $height;

    if &#40; $width <= $allowed_width && $height <= $allowed_height &#41; &#123;
         $resized_width = $width;
         $resized_height = $height;
    &#125; elseif &#40; &#40; $x_ratio * $height &#41; < $allowed_height &#41; &#123;
                   $resized_height = ceil &#40; $x_ratio * $height &#41;;
                   $resized_width = $allowed_width;
    &#125; else &#123;
         $resized_width = ceil  &#40;$y_ratio * $width &#41;;
         $resized_height = $allowed_height;
Zeile 79: $x_ratio = $allowed_width / $width;
Zeile 80: $y_ratio = $allowed_height / $height;