PHP Classes
elePHPant
Icontem

PTX PHP GD Analog Clock: Render the time on analog clock as an image

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (17)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-02-01 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 287 All time: 7,396 This week: 373Up
Version License PHP version Categories
ptx-clock 2GNU Lesser Genera...5.3HTML, PHP 5, Time and Date, Graphics
Description Author

This package can render the time on analog clock as an image.

It takes a time string with hours and minutes and renders an image displaying the pointers on circular analog clock.

There are two class variants: one that draws the clock pointers inside a circle and that renders the pointers over a base background image.

The resulting image can be saved to a PNG file or outputted as the current script output.

Innovation Award
PHP Programming Innovation award nominee
May 2015
Number 15
Many applications need to display the current time. They usually display a text string with the time, but sometimes it is nicer to display the time as a drawing of an analog clock.

This class can display the current time as an analog clock rendered as an image that can be displayed on the browser.

Manuel Lemos
  Performance   Level  
Name: Tomas Pavlatka <contact>
Classes: 3 packages by
Country: Czech Republic Czech Republic
Age: 37
All time rank: 223626 in Czech Republic Czech Republic
Week rank: 778 Up7 in Czech Republic Czech Republic Up
Innovation award
Innovation award
Nominee: 2x

 

Details

PTX-Clock

PHP Class to create analog clock from the time given. I have a son and they are teaching him at school the clock. I though it would be great to create a simple game to help him out. This class is just a beginning of the whole idea.

Installation

You will need a composer to install autoload for you

composer install --no-dev

Example

require_once './vendor/autoload.php';

try {
    $clock = new PTX\Clock('09:55');
    $clock->draw();
    $clock->to_browser();
} catch(\PTX\ClockException $e) {
    echo $e->getMessage();
}

Example online

Visit my page and see it in action.

  PTX ClockExternal page  

Open in a separate window

  Files folder image Files  
File Role Description
Files folder imagecache (1 file)
Files folder imageexample (2 files, 3 directories)
Files folder imagefonts (1 directory)
Files folder imagesrc (1 directory)
Files folder imagetests (2 files)
Accessible without login Plain text file canvas.php Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

  Files folder image Files  /  cache  
File Role Description
  Accessible without login Plain text file empty Data Auxiliary data

  Files folder image Files  /  example  
File Role Description
Files folder imagecache (1 file)
Files folder imagecss (1 file)
Files folder imagejs (1 file)
  Accessible without login Plain text file clock.php Example Example script
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  example  /  cache  
File Role Description
  Accessible without login Plain text file empty Data Auxiliary data

  Files folder image Files  /  example  /  css  
File Role Description
  Accessible without login Plain text file ptx.css Data Auxiliary data

  Files folder image Files  /  example  /  js  
File Role Description
  Accessible without login Plain text file ptx.js Data Auxiliary data

  Files folder image Files  /  fonts  
File Role Description
Files folder imageennobled (1 file)

  Files folder image Files  /  fonts  /  ennobled  
File Role Description
  Accessible without login HTML file read_me.html Data Fonts license

  Files folder image Files  /  src  
File Role Description
Files folder imageptx (3 files)

  Files folder image Files  /  src  /  ptx  
File Role Description
  Plain text file Clock.php Class Class source
  Plain text file ClockCanvas.php Class Class source
  Plain text file ClockException.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file ClockBaseTest.php Test Unit test script
  Accessible without login Plain text file ClockTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:287
This week:0
All time:7,396
This week:373Up