} } ($code = $plugins->load('images_rating_start')) ? eval($code) : null; $ratings = array(); while ($row = $db->fetch_assoc($result)) { $ratings[] = $row['rating']; } $ratingcounter = count($ratings); if ($ratingcounter > 0) { $rating = round((array_sum($ratings) / $ratingcounter + 1) * ($width / 2)); $avg = array_sum($ratings) / $ratingcounter; } else { $rating = $width / 2; $avg = 0; } $five = ceil(($avg + 1) * 2.5); header("Content-type: image/png"); $image = imagecreate($width + 2, $height + 2); $back = ImageHexColorAllocate($image, 'ffffff'); $fill = ImageHexColorAllocate($image, $colors[$five]); $border = ImageHexColorAllocate($image, '000000'); ImageFilledRectangle($image, 1, 1, $width, $height, $back); ImageFilledRectangle($image, 1, 1, $rating, $height, $fill); ImageRectangle($image, 0, 0, $width + 1, $height + 1, $border); imagePNG($image); imagedestroy($image); } ($code = $plugins->load('images_end')) ? eval($code) : null; $slog->updatelogged(); $zeitmessung = t2(); $db->close();