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
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 : 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 7 times)
Viewed : 11019
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
Monthly and Daily Upcoming Events calendar.
Categories : Date Time, PostgreSQL, PHP, Calendar, Databases



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
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
function to generate calendars on the fly.
Categories : Calendar, PHP, Date Time
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
GetImageSize -- Get the size of a GIF, JPEG, PNG or SWF image
Categories : PHP, PHP Functions, Graphics
Change the background color of a website daily dynamically using the php date function to get the current day of the week and depending on that day, set the background color for the web page.
Categories : PHP, Date Time, Beginner Guides, Web Design
Phorum, MySQL, Language, UK date format, MySQL UK Date format
Categories : PHP, Date Time, Strings, MySQL, Databases
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
calculus of the eastersunday
Categories : BC math, PHP, Date Time, Databases
Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June).
Categories : Calendar, Date Time, PHP
 Christophe LAUER wrote :527
Hi all,

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

Regards,
CL