WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Image Generation Class ( PNG Format )
Categories : PHP, GD image library, PHP Classes, Graphics Click here to Update Your Picture
Saravanan .R
Date : Apr 18th 2005
Grade : 3 of 5 (graded 6 times)
Viewed : 6135
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Saravanan .R
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?

/*--------------------------------------------------------------------
*     
*    Class Name : ProgressBar   
*   
*    Class to generate the PNG image format of the given width, height and percentage.
*
*    Function Name : createBar()
*        Args      : 1. <$width> Width of the Progress Bar Image
*                    2. <$height> Height of the Progress Bar Image
*                    3. <$percentage> Percentage Completed of the Progress Bar Image

*  @returns IMAGE
*
*  Send Your FeedBack, Suggesstion and Comments: saravanan.r@gmail.com
*/


     
class ProgressBar {
         var
$BarWidth ;                 
         var
$BarHeight ;       
         var
$shade ;             
         var
$completed;
        var
$wdth;
        var
$font;       
        var
$txtlocation ;
         var
$prog_cold ;
        var
$image ;
        var
$ends ;
        var
$text_color;
        var
$bgcolor;
         function
__CONSTRUCT ($Width, $Height, $percentageCompleted) {
             
$this->BarWidth = $Width ;
             
$this->BarHeight = $Height;
             
$this->ends = $Height - 1 ;
             
$this->wdth = $Width - 1 ;
             
$this->btm = $Width ;
             
             
$this->txtlocation = ( $Width / 2 ) - 15 ;
             
$this->image = imagecreate($this->BarWidth, $this->BarHeight);
             
$this->completed = ( $this->BarWidth / 100 ) * $percentageCompleted ;
             
$this->prog_color = imagecolorallocate($this->image,44, 143, 30);
             
$this->shade = imagecolorallocate($this->image, 0, 0, 0);
             
             if (
$percentageCompleted > 50 ) {
                 
$this->text_color = imagecolorallocate($this->image, 255, 255, 255);
             }
             else {
                 
$this->text_color = imagecolorallocate($this->image, 0, 0, 0);
             }             
             
             
$this->bgcolor = imagecolorallocate($this->image, 246, 246, 232);
             
$this->font = str_replace("\\","/",$_SERVER['SystemRoot'] ."/FONTS/verdana.ttf");
             
             
imagefilledrectangle($this->image, 0, 0, $this->BarWidth, $this->ends, $this->bgcolor);
             
imagefilledrectangle($this->image, 0, 0, $this->completed, $this->ends, $this->prog_cold);
             
imageline($this->image,0,17, $this->BarWidth, $this->ends, $this->shade);
             
imageline($this->image,$this->wdth, 0, $this->wdth, $this->ends, $this->shade);
             
             
imagettftext($this->image, 9, 0, $this->txtlocation, 14, $this->text_color, $this->font,($this->completed/2) ."%");
         }
         

         function
createBar() {
             return
$this->image ;
         }

     }   

         
         
//    header("content-type:image/png");
         
         
echo "<B>Progressing ....</b>";         
         
       
//    for ($i=1; $i <= 100 ; $i++) {
         //    sleep(.4);
             
$createBar = new ProgressBar(200,18,20);
             
$display = $createBar->CreateBar();
             
$imagename = "bar.png" ;
             
imagepng($display,$imagename);
             echo
"<BR><img src=$imagename id=bar><BR>" ;
       
//    }
?>



crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
Advanced Image WaterMarker
Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented
Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs
imageMarker v 3.00 with new advanced features
Categories : PHP, PHP Classes, Graphics, GD image library
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Render TTF Text to PNG. Text message, font, size, rotation, padding, color, background, and transparency can all be defined via URL.
Categories : PHP, PHP Classes, Graphics
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout.
Categories : Graphics, Arrays, PHP, PHP Classes, Charts and Graphs
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email
Line graphics generation library written in PHP + GD library (spanish comments)
Categories : PHP, Graphics, GD image library
PHPDRAW, the php wannabe Photoshop ;-)
Categories : PHP, PHP Classes, GD image library, Arrays
Image Cache
Categories : Graphics, PHP Classes, PHP
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
 Khair-ed Din Husseini wrote :1308
Don`t you think it is a bit too much to do a class for all of that?
you could just tka a 1px png, gif, or jpg....whatever you like

&lt;img src="1px.png" height="50px" width="&lt;?php echo $process;"?&gt;