PHP图像维度 [英] PHP image dimension
本文介绍了PHP图像维度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取图像的宽度和高度?
How to get width and height of an image?
我有 $ variable ='http://site.com/image。 png
想要将此图片的宽度设置为 $ width
和高度为 $ height
。
Want to get width of this image to $width
and height to $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];
这篇关于PHP图像维度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文