题
如何获得图像的宽度和高度?
我有 $variable = 'http://site.com/image.png"
想将此图像的宽度 $width
和高度 $height
.
像:$variable = 'http://site.com/image.png"
$width = '300'; // image width is 300px
$height = '500'; // height is 500px
谢谢。
解决方案
$variable = 'http://site.com/image.png';
$image = getimagesize($variable);
$width = $image[0];
$height = $image[1];
$type = $image[2];
其他提示
getimagesize 功能。也许会帮助您。
不隶属于 StackOverflow