Analyzing Images PHP

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.

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

array getimagesize(string filename, array image_info)
The getimagesize function returns a four-element array that tells you the image size of the given filename. The contents of this array are listed. The file must be a graphic file in one of three formats: GIF, JPEG, or PNG. The optional image_info argument will be set with additional information from the file. At the time of this writing, this array is set with APP markers 0–15 from JPEG files. One of the most common is APP13, which is an International Press Telecommunications Council (IPTC) block. These blocks are used to communicate information about electronic media released to news agencies. They are stored in binary form, so to decode them you must use the iptcparse function.
Note that the image_info argument must be passed by reference, which means it must be preceded by an ampersand.

$image_file = "php.jpg";
$image_size = getimagesize($image_file, &$image_info);
print("IMG SRC="$image_file" $image_size[3]>BR> ");
//show information if it exists
while(list($key, $value) = each($image_info))
print($key . "BR> ");

string iptcembed(string iptc, string file, integer spool)
The iptcembed function adds IPTC blocks to JPEG files. By default the blocks are added to the file, and the modified file is returned. The spool argument allows you to change this behavior. If the spool flag is 1 or 2, then the modified JPEG will be sent directly to the browser. If the spool flag is 2, the JPEG will not be returned as a string.

array iptcparse(string iptc_block)
The iptcparse function takes an IPTC block and returns an array containing all the tags in the block. See the description

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

PHP Topics