您好,欢迎访问一九零五行业门户网

函数getimagesize获得图片的长宽等信息

函数getimagesize返回一个具有四个单元的数组。
索引 0 包含图像宽度的像素值,
索引 1 包含图像高度的像素值。
索引 2 是图像类型的标记:1 = gif,2 = jpg,3 = png,4 = swf,5 = psd,6 = bmp,7 = tiff(intel byte order),8 = tiff(motorola byte order),9 = jpc,10 = jp2,11 = jpx,12 = jb2,13 = swc,14 = iff,15 = wbmp,16 = xbm。
这些标记与 php 4.3.0 新加的 imagetype 常量对应。索引 3 是文本字符串,内容为“height=yyy width=xxx”,可直接用于 img 标记。
php官网手册 $images_array = array(http://static.zend.com/img/logo.gif);foreach($images_array as $image){ list($width, $height, $type, $attr) = getimagesize($image); $new_height = (int)(192 / $width * $height); echo '';}
复制代码
其它类似信息

推荐信息