php获得图像的属性函数
<?php /** 【达内就业】
* 取得图像信息
*
* 用法:
* --------------------------------------
* $info = getImageInfo('test.jpg');
* --------------------------------------
* www.
* @param string $image 图像文件名
*
* @return mixed
*/
function getImageInfo($image) {
$imageInfo = getimagesize($image);
if ($imageInfo !== FALSE) {
$imageType = strtolower(substr(image_type_to_extension($imageInfo[2]), 1));
$imageSize = filesize($image);
$info = array(
"width" => $imageInfo[0],
"height" => $imageInfo[1],
"type" => $imageType,
"size" => $imageSize,
"mime" => $imageInfo['mime']
);
return $info;
} else {
return FALSE;
}
}
?>