|
|
|
<?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 | | | crop and resize image class using gd library function Categories : PHP, PHP Classes, GD image library, Graphics | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | PHP Email image generator - hide your email from bots - using the GD Library Categories : PHP, Graphics, GD image library, Beginner Guides | | | A couple of functions that convert an IP address into its color code and not-color-code. Useful when viewing an apache log with a mysql result grouped by IP Categories : PHP, Graphics, Databases | | | How to display any array in several rows and columns of a table. Not just
in one column or in alternate rows. This example shows a nice color table
generated with PHP, but can be used with any array values(e.g. Database) Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics | | | 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 | | | A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time, PHP, Complete Programs, Calendar | | | A Timing Class Categories : PHP, PHP Classes, Date Time | | | webcam cam view image ispy browser independant Categories : Graphics, HTML, HTML and PHP, PHP | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | If you want to create select buttons featuring current date this example will show you how... Categories : Date Time, HTML and PHP, PHP | | | Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used. Categories : HTML and PHP, PHP, Date Time | |
| | | | Christophe LAUER wrote :527
Hi all,
My e-mail address is now clauer@free.fr
Regards,
CL
| |
|
|
|