Home > Backend Development > PHP Tutorial > php 判断是不是为PNG格式的图片

php 判断是不是为PNG格式的图片

WBOY
Release: 2016-06-13 13:04:26
Original
1263 people have browsed it

php 判断是否为PNG格式的图片


function isPng($pngPath)
{
	$size = getimagesize ($pngPath); 

	$file_extension = strtolower(substr(strrchr($pngPath,'.'),1));

	if('image/png' != $size['mime'] || $file_extension != 'png')
	{ 
		return FALSE; 
	} 
	else {
		return TRUE;
		
	}
	
}
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template