Fork me on GitHub

PHP获取图片宽度高度、大小尺寸、图片类型、用于布局的img属性

//php自带函数 getimagesize()
$img_info = getimagesize('tomener.jpg');

echo '<pre>';

print_r($img_info);

输出:

Array
(
[0] => 170
[1] => 254
[2] => 2
[3] => width="170" height="254"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
这次要用到的就是第四个元素了

posted @ 2014-01-06 12:12  磊哥|www.javacn.site  阅读(48731)  评论(1编辑  收藏  举报