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

时间:2018-01-26 04:53:31

标签: php image height width

我想知道使用imageCreateFromBMP($ src)而不是$ src从返回图像中获取图像的图像宽度和高度。我怎样才能做到这一点?

$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>';

1 个答案:

答案 0 :(得分:2)

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>';
相关问题