mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 06:35:15 +00:00
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:
parent
59da3dfe03
commit
f1a3b281d4
2 changed files with 10 additions and 2 deletions
|
@ -541,7 +541,7 @@ function guess_image_type($filename, $headers = '') {
|
|||
// we aren't using imagick can find it
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(is_null($type)) {
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$ph = photo_factory('');
|
||||
|
@ -551,6 +551,14 @@ 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;
|
||||
|
|
|
@ -137,4 +137,4 @@ class photo_gd extends photo_driver {
|
|||
return $string;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue