当前位置:Gxlcms > PHP教程 > phpgetimagesize_PHP教程

phpgetimagesize_PHP教程

时间:2021-07-01 10:21:17 帮助过:7人阅读

php getimagesize

getimagesize是读取图片相关信息,返回一个具有四个单元的数组。索引 0 包含图像宽度的像素值,索引 1 包含图像高度的像素值。索引 2 是图像类型的标

$size = getimagesize($filename);
$fp = fopen($filename, "rb");
if ($size && $fp) {
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
} else {
// error
}
?>


#2 getimagesize() example

list($width, $height, $type, $attr) = getimagesize("https://www.gxlcms.com/img/flag.jpg");
echo "getimagesize() example";
?>

Example #3 getimagesize (URL)

$size = getimagesize("http://www.example.com/gifs/logo.gif");
$size = getimagesize("http://www.example.com/gifs/lo%20go.gif");
?>

Example #4 getimagesize() returning IPTC

$size = getimagesize("testimg.jpg", $info);
if (isset($info["APP13"])) {
$iptc = iptcparse($info["APP13"]);
var_dump($iptc);
}
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445015.htmlTechArticlephp getimagesize getimagesize是读取图片相关信息,返回一个具有四个单元的数组。索引 0 包含图像宽度的像素值,索引 1 包含图像高度的像素值...

人气教程排行