【发布时间】:2014-07-11 10:35:48
【问题描述】:
我想从 url 获取图像的宽度和高度,但它不起作用。它说
警告:getimagesize(https://scontent-b-sin.xx.fbcdn.net/hphotos-xpa1/t1.0-9/156922_131613136994348_1325598195_n.jpg) [function.getimagesize]:无法打开流:第 4 行 D:\AppServ\www\test\test6.php 中的参数无效
PHP
$url = "https://scontent-b-sin.xx.fbcdn.net/hphotos-xpa1/t1.0-9/156922_131613136994348_1325598195_n.jpg";
list($width, $height, $type, $attr) = getimagesize($url);
echo "Image width " . $width ."<br />";
echo "Image height " . $height ."<br />";
echo "Image type " . $type ."<br />";
echo "Attribute " . $attr ."<br />";
?>
使用我电脑中的路径是可行的。发生了什么事?谢谢。
【问题讨论】:
-
你能不能查一下
phpinfo();上面写着Registered PHP Streams的部分,..必须有以下内容:https, http and compress.zlib,可以肯定的是,你能用图片中的图片测试一下吗与您的 PHP 脚本相同的文件夹并尝试该本地图片? -
getimagesize 响应非常慢,请尝试以下解决方案。 stackoverflow.com/questions/4635936/…
-
@DanFromGermany 同一文件夹中图像的路径和本地都可以。它不仅适用于来自网络的 URL。
标签: php