/**
* Image processing-Get image information
* @param string $source source file picture
* @return Array (width, height, type of picture)
*/
function Get_img_info ($source) {
$imginfo = Array ();
$ext = Strtolower (substr (STRRCHR ($source, '. '), 1)); Get Picture Type
$image _type = Array (1 = ' gif ', 2 = ' jpeg ', 3 = ' png ', 6 = ' bmp ');
if (function_exists (' Read_exif_data ') && In_array ($ext, array (' jpg ', ' jpeg ', ' jpe ', ' jfif ')) {//jpeg case
$temp = @read_exif_data ($source);
$imginfo [' width '] = $temp [' COMPUTED '] [' width '];
$imginfo [' height '] = $temp [' COMPUTED '] [' height '];
$imginfo [' type '] = 2;
Unset ($temp);
}
if (empty ($imginfo)) {//png,gif,bmp
List ($imginfo [' width '], $imginfo [' height '], $imginfo [' type ']) = @getimagesize ($source);
}
$imginfo [' type '] = $image _type[$imginfo [' type ']];
$size = $imginfo [' width ']/$imginfo [' height '];
Return round ($size, 2); Take two-bit
}
Return picture aspect ratio