PHP getimagesize函数和image_type_to_extension函数
获取图片尺寸
getimagesize($image_path)
Array(
[0] => 256 //宽
[1] => 256 //高
[2] => 3 //IMAGETYPE常量,代表某种图片类型
[3] => width="256" height="256"
[bits] => 8
[mime] => image/png
)
根据 getimagesize() 返回的 IMAGETYPE常量 获取图片类型(扩展名)
image_type_to_extension(IMAGETYPE常量)
没有匹配结果时返回 false
1: .gif 2: .jpeg 3: .png 4: .swf 5: .psd 6: .bmp 7: .tiff 8: .tiff 9: .jpc 10: .jp2 11: .jpx 12: .jb2 13: .swf 14: .iff 15: .bmp 16: .xbm 17: .ico 18: .webp