diff options
author | Mario <mario@mariovavti.com> | 2021-02-01 22:58:55 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-02-01 22:58:55 +0000 |
commit | 08c9152abdfa90da09931bdcc6e6c81ea243434c (patch) | |
tree | 18e734556a01699a883113e31fd54d1e1df688e5 /include/photo | |
parent | 70fa7ad8d0fe3bab4f9702ba2d5ac0065977c567 (diff) | |
download | volse-hubzilla-08c9152abdfa90da09931bdcc6e6c81ea243434c.tar.gz volse-hubzilla-08c9152abdfa90da09931bdcc6e6c81ea243434c.tar.bz2 volse-hubzilla-08c9152abdfa90da09931bdcc6e6c81ea243434c.zip |
fix getting mimetype via getimagesize() and do not default to image/jpeg yet if it could not be found
Diffstat (limited to 'include/photo')
-rw-r--r-- | include/photo/photo_driver.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 97871e139..87b1d96fe 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -69,7 +69,7 @@ function photo_factory($data, $type = null) { * @return null|string Guessed mimetype */ function guess_image_type($filename, $data = '') { - + if($data) $headers = (is_array($data) ? $data['header'] : $data); @@ -135,9 +135,10 @@ function guess_image_type($filename, $data = '') { } } - if(is_null($type) && strpos($filename, 'http') === false) { + if(is_null($type) && strpos($filename, 'http') === 0) { $size = getimagesize($filename); - $type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg'); + if (array_key_exists($size['mime'], $types)) + $type = $size['mime']; } if(is_null($type)) { |