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
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
Mobile Dev World

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 : Simple graphic clock/watch generation using gd library.
Categories : Graphics, Date Time, PHP Update Picture
Christophe Lauer
Date : May 05th 1999
Grade : 3 of 5 (graded 8 times)
Viewed : 12407
File : AnalogClock.php3
Images : No Images for this code example.
Search : More code by Christophe Lauer
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php

// AnalogClock :
// This small PHP3 script has been written by Christophe Lauer
// (mailto:clauer@citeweb.net) to serve as an example for libgd.
//
// Feel free to use it as you like, you're even allowed to say
// it's your's if you like... Mail me if you like it, or if you
// can write it shorter. Comments are welcome ;-) This is emailware
//

function draw_radius($img, $x, $y, $r, $ang, $col)
{
$x1 = $x + $r * cos($ang);
$y1 = $y + $r * sin($ang);

ImageLine($img, $x, $y, $x1, $y1, $col);
}

dl('php3_gd.dll');
// Win32 users should replace prev line with dl('php3_gd.dll');

// specify coords for the origins of the hands
// depends of the picture used as a background - draw your own !
$centrx = 29;
$centry = 29;

// depends on the background picture too.
$rmin = 22 ; // radius for minutes hand
$rhour = 12; // radius for hours        hand

//
// ^ -Pi/2 rad => 0 min
// |
// |
// |
// |
// --------> O rad => 15 min
//

$minrad = -1 * (pi()/2) ; // origin is -PI/2
$hourrad = -1 * (pi()/2) ; // same as above.

// Calculate the angles for drawing the hands
$hour = (date("h")/12)*2*pi() - (pi()/2);
$min = (date("i")/60)*2*pi() - (pi()/2);

// Output the HTTP header Content-type        
Header('Content-type: image/gif');

// specify path to background image file
$mypath = '/home/clauer/php3sampl/images/';

// Load watch background picture from file
$im = ImageCreateFromGIF($mypath.'watchframe.gif');

// Use pseudo "phosphore" light green for both hands
$mycolor = ImageColorAllocate($im, 153, 255, 204);

// Draw the hours and minutes hands
draw_radius($im, $centrx, $centry, $rmin, $min, $mycolor);
draw_radius($im, $centrx, $centry, $rhour, $hour, $mycolor);

// Send GIF output to client
ImageGif($im);
ImageDestroy($im);
?>



PHP Round Clock - Must have Gif support to use this.
Categories : PHP, Date Time, Graphics
Shows the current time as a PNG-image. This script does not use the GD library. You can use it as a benchmark (because it's slow), or as a quick reference for implementing a simple PNG-file generator.
Categories : Graphics, Zlib, Calendar, PHP, Date Time
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
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
Simple function to return the number of days in a time span between 2 given dates.
Categories : PHP, Date Time, MySQL, Databases
Bs_StopWatch is a class to measure time intervals in microseconds.
Categories : PHP, Date Time, PHP Classes
Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase
PHPixel - output of 1 pixel transparent/colored gif for counters etc.
Categories : PHP, Graphics, HTML and PHP
Calendars to choose a range of dates , reservation events ...
Categories : PHP, Calendar, Java Script, Date Time
Upload images restricted by pixel size (Picture width and Picture Height)
Categories : PHP, HTML and PHP, Graphics
Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations.
Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs
Function to convert Arabic numbers into Roman Numerals
Categories : Algorithms, PHP, Date Time
Simple conversion functions to change MySQL dates to arrays, arrays to MySQL dates.
Categories : PHP, Arrays, Date Time, Databases, MySQL
Generate image with random number (CAPTCHA)
Categories : PHP, GD image library, Graphics, Security
 Christophe LAUER wrote :527
Hi all,

My e-mail address is now clauer@free.fr

Regards,
CL