pathinfo() does not work in this case. getimagesize() seems more reliabel. this fixes transparent png avatars having a black background.

This commit is contained in:
Mario Vavti 2015-10-28 20:01:50 +01:00
parent 612efe56f1
commit 1375ed6aea

View File

@ -542,6 +542,7 @@ function guess_image_type($filename, $headers = '') {
}
}
/*
if(is_null($type)) {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$ph = photo_factory('');
@ -551,6 +552,13 @@ function guess_image_type($filename, $headers = '') {
if ($ext==$e) $type = $m;
}
}
*/
if(is_null($type)) {
$size = getimagesize($filename);
$ph = photo_factory('');
$types = $ph->supportedTypes();
$type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg');
}
}
logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
return $type;