在 PHP 代码中,给定一个 .png 图像路径,我需要检测该图像的位深度。我怎样才能做到这一点?
我尝试使用 getImageSize() 并阅读bits
以下示例代码,但对于 24 位/32 位图像,它总是返回“8”。
请帮忙。
class Utils {
//Ham de lay bits cua image
public static function getBits($image) {
$info = getImageSize($image);
return $info['bits'];
}
}