getimagesize()
function returns FALSE
for some images.
$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);
In both cases, it returns FALSE
, I have searched, but not found a good solution yet.
Its working :
You must provide the absolute path:
For example:
$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>";
Result:
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"
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.