note 80851 modified in function.imagefilledrectangle by felipe

From: Date: Mon, 04 Feb 2008 20:20:11 +0000
Subject: note 80851 modified in function.imagefilledrectangle by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135766@lists.php.net to get a copy of this message
This is a very simple Progress Bar using basic PHP 5. <?php #Created by Kyle "KP" Perkins # of Shadow Development Technologies (http://shadowdev.com) # on 20080204 #very simple and flexible dynamic PROGRESS BAR #Used under the Creative Commons Share-Alike License 3.0 #http://creativecommons.org/licenses/by-sa/3.0/us/ #use: index.php?percent/total/width(px) #example: ?s=85/100/300 #edit how you like, comments to kyperkins@shadowdev.com header("Content-type: image/png"); extract($_GET); $num=explode("/", $s); $width=$num[2]; $per=($num[0]/$num[1]) * 100; $percent=round($per, 0); $im = @imagecreate($width, 20) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 200,200,200); $text_color = imagecolorallocate($im, 255, 255, 255); $fill=($percent/100)*$width; $offset=($width/2)-($width*.02); imagestring($im, 3, $offset, 5, "$percent%", $text_color); imagefilledrectangle($im, 0, 0, $fill, 20, imagecolorallocate($im, 0, 0, 255)); imagestring($im, 3, $offset, 5, "$percent%", $text_color); imagepng($im); imagedestroy($im); ?> --was-- This is a very simple Progress Bar using basic PHP 5. <?php #Created by Kyle "KP" Perkins # of Shadow Development Technologies (http://shadowdev.com) # on 20080204 #very simple and flexible dynamic PROGRESS BAR #Used under the Creative Commons Share-Alike License 3.0 #http://creativecommons.org/licenses/by-sa/3.0/us/ #use: index.php?percent/total/width(px) #example: ?85/100/300 #edit how you like, comments to kyperkins@shadowdev.com header("Content-type: image/png"); extract($_GET); $num=explode("/", $s); $width=$num[2]; $per=($num[0]/$num[1]) * 100; $percent=round($per, 0); $im = @imagecreate($width, 20) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 200,200,200); $text_color = imagecolorallocate($im, 255, 255, 255); $fill=($percent/100)*$width; $offset=($width/2)-($width*.02); imagestring($im, 3, $offset, 5, "$percent%", $text_color); imagefilledrectangle($im, 0, 0, $fill, 20, imagecolorallocate($im, 0, 0, 255)); imagestring($im, 3, $offset, 5, "$percent%", $text_color); imagepng($im); imagedestroy($im); ?> http://php.net/manual/en/function.imagefilledrectangle.php

« previous php.notes (#135766) next »