문제

How to get width and height of an image?

I have $variable = 'http://site.com/image.png"

Want to get width of this image to $width and height to $height.

Like: $variable = 'http://site.com/image.png"

$width = '300'; // image width is 300px
$height = '500'; // height is 500px

Thanks.

도움이 되었습니까?

해결책

$variable = 'http://site.com/image.png';
$image    = getimagesize($variable);
$width    = $image[0];
$height   = $image[1];
$type     = $image[2];

다른 팁

getimagesize function. Maybe it will help you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top