|
|
|
<?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
| |
|
|