aboutsummaryrefslogtreecommitdiffstats
path: root/include/photo/photo_driver.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-10-28 20:01:50 +0100
committerMario Vavti <mario@mariovavti.com>2015-10-28 20:01:50 +0100
commit1375ed6aea765f16ff70606187d1458ee85ea6d9 (patch)
tree46e0f57dc4946b026f2095f272cb1b8b10484944 /include/photo/photo_driver.php
parent612efe56f16955a9c202193fe246789825e939db (diff)
downloadvolse-hubzilla-1375ed6aea765f16ff70606187d1458ee85ea6d9.tar.gz
volse-hubzilla-1375ed6aea765f16ff70606187d1458ee85ea6d9.tar.bz2
volse-hubzilla-1375ed6aea765f16ff70606187d1458ee85ea6d9.zip
pathinfo() does not work in this case. getimagesize() seems more reliabel. this fixes transparent png avatars having a black background.
Diffstat (limited to 'include/photo/photo_driver.php')
-rw-r--r--include/photo/photo_driver.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 32b9bd302..d439e9877 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -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;