re-enable pathinfo() check and try with getimagesize() if we have not got a result
This commit is contained in:
parent
1375ed6aea
commit
a5f1fa3168
@ -542,23 +542,22 @@ function guess_image_type($filename, $headers = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(is_null($type)) {
|
if(is_null($type)) {
|
||||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||||
$ph = photo_factory('');
|
$ph = photo_factory('');
|
||||||
$types = $ph->supportedTypes();
|
$types = $ph->supportedTypes();
|
||||||
$type = "image/jpeg";
|
|
||||||
foreach ($types as $m=>$e){
|
foreach ($types as $m=>$e){
|
||||||
if ($ext==$e) $type = $m;
|
if ($ext==$e) $type = $m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if(is_null($type)) {
|
if(is_null($type)) {
|
||||||
$size = getimagesize($filename);
|
$size = getimagesize($filename);
|
||||||
$ph = photo_factory('');
|
$ph = photo_factory('');
|
||||||
$types = $ph->supportedTypes();
|
$types = $ph->supportedTypes();
|
||||||
$type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg');
|
$type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
|
logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
|
||||||
return $type;
|
return $type;
|
||||||
|
Reference in New Issue
Block a user