getimagesize()
函数返回FALSE
。
$path1 = getcwd().'/images/communities/29/eagle-ridge-26.jpg';
$vals_arr1 = getimagesize($path1);
$path2 = 'http://homematrix.oskyserver.com/images/communities/29/
eagle-ridge-26.jpg';
$vals_arr2 = getimagesize($path2);
在这两种情况下,它都返回FALSE
,我已经搜索过,但还没有找到一个好的解决方案。
答案 0 :(得分:0)
它的工作:
您必须提供绝对路径:
例如:
$path1 = getcwd().'/images/logo.jpg';
$vals_arr1 = getimagesize($path1);
echo "<pre>";var_dump($vals_arr1);echo "</pre>";
$path2 = __DIR__.DIRECTORY_SEPARATOR.'images/logo.jpg';
$vals_arr2 = getimagesize($path2);
echo "<pre>";var_dump($vals_arr2);echo "</pre>";
结果:
array(7) {
[0]=>
int(288)
[1]=>
int(70)
[2]=>
int(2)
[3]=>
string(23) "width="288" height="70""
["bits"]=>
int(8)
["channels"]=>
int(3)
["mime"]=>
string(10) "image/jpeg"
}
array(7) {
[0]=>
int(288)
[1]=>
int(70)
[2]=>
int(2)
[3]=>
string(23) "width="288" height="70""
["bits"]=>
int(8)
["channels"]=>
int(3)
["mime"]=>
string(10) "image/jpeg"
}