exif_imagetype() 函数在linux下的php中不存在,写个函数替代下
if ( ! function_exists( 'exif_imagetype' ) ) {
function exif_imagetype ($filename ) {
if ( (list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) {
return $type;
}
return false;
}
}
本文提供了一个在Linux环境下PHP中exif_imagetype()函数不存在时的替代实现方式,通过getimagesize()函数获取文件类型信息。
exif_imagetype() 函数在linux下的php中不存在,写个函数替代下
if ( ! function_exists( 'exif_imagetype' ) ) {
function exif_imagetype ($filename ) {
if ( (list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) {
return $type;
}
return false;
}
}
1285
465
850

被折叠的 条评论
为什么被折叠?