<?php
$file_path = 'image/123.jpg';
$fileInfo = getimagesize($file_path);
if ($fileInfo !== false){
$imageType = strtolower(substr(image_type_to_extension($fileInfo[2]), 1));
$info = array(
'windth' => $fileInfo[0],
'height' => $fileInfo[1],
'type' => $imageType,
'size' => filesize($file_path),
'mime' => $fileInfo['mime']
);
print_r($info);
}
输出
Array
(
[windth] => 1200
[height] => 800
[type] => jpeg
[size] => 171751
[mime] => image/jpeg
)
网友评论