Widgets » Usage

Copyright© 2005 Peter Taurins

Widgets are free software; you can redistribute it and/or modify it under the terms of the Creative Commons

Widgets are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Creative Commons License for more details.

The software expects the font files to be in /resources so ensure that you place your TTF (True Type Font) file in the /resources direcory.

Create a new file, call it example.php

Include the software (amending the path as necessary) and set the variables:

  • require($_SERVER["DOCUMENT_ROOT"]."/widgets/thermometer.php");
  • $my_thermometer = new thermometer();
  • $my_thermometer->setTitle("Thermometer");
  • $my_thermometer->setRange(100);
  • $my_thermometer->setValue(50);
  • $my_thermometer->setLabel("Temperature");
  • $my_thermometer->drawThermometer();

Include the software (amending the path as necessary) and set the variables:

  • require($_SERVER["DOCUMENT_ROOT"]."/widgets/gauge.php");
  • $my_gauge = new dialGauge();
  • $my_gauge->setTitle("GeoMeter");
  • $my_gauge->setValue(25);
  • $my_gauge->setLabelBottom("Sane");
  • $my_gauge->setLabelTop("Insane");
  • $my_gauge->setColor(array("00FF00","FFFF00","FF0000"));
  • $my_gauge->setAngle(array(1,45,180));
  • $my_gauge->drawGauge();

Include the software (amending the path as necessary) and set the variables:

  • require($_SERVER["DOCUMENT_ROOT"]."/widgets/tuner.php");
  • $my_tuner = new tuner();
  • $my_tuner->setTitle("Radio Tuner");
  • $my_tuner->setRange(100);
  • $my_tuner->setValue(60);
  • $my_tuner->setLabelLeft("Colder");
  • $my_tuner->setLabelRight("Hotter");
  • $my_tuner->drawTuner();

Generate the image either by calling the file example.php directly in your browser or by wrapping it in an image tag for display on your webpage.
<img src="example.php">