从 imageCreateFromBMP($src) 获取图像 php 的宽度和高度

get Width and height of image php from imageCreateFromBMP($src)

我想使用 imageCreateFromBMP($src) 而不是 $src 来了解来自 return 图像的图像的图像宽度和高度。我怎样才能做到这一点?

$src = 'four.bmp'; //src of image
$im = imagecreatefrombmp($src); 
list($width, $height) = GetImageSize($im); // it doesnot work though it takes string 
echo 'Image width '.$width.'</br>';
echo 'Image height '.$height.'</br>';

imagesx()imagesy()取一个图片资源

示例:

$src = 'four.bmp'; //src of image
$im = imagecreatefrombmp($src); 
$width = imagesx($im);
$height = imagesy($im);
echo 'Image width '.$width.'</br>';
echo 'Image height '.$height.'</br>';