O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Analyzing Images

These functions are part of PHP's core and do not require loading an extension.

string gamma_correct_tag(string color, double original, double new)

The gamma_correct_tag function adjusts an HTML color from one gamma to another. Video display hardware is given a gamma rating that describes relatively how bright images appear. Identical images appear lighter on Macintosh hardware than on the typical Wintel clone. The W3C has a nice discussion about color spaces that includes information about gamma values: <http://www.w3.org/Graphics/Color/sRGB.html>.

<?
  //go from Windows gamma to Macintosh gamma
  $color = gamma_correct_tag("#CC0000", 2.2, 1.571);
  
  print("FONT COLOR=\"$color\">");
  print("Sample Text");
  print("/FONT>");
?>

array ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required