aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-10-28 16:59:23 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-10-28 16:59:23 -0700
commit1f5818cec875caaef60c62b03498e15835722a5a (patch)
tree152aeed54ef938ffff7ed0b45677ce8c8a3234ba /include
parent06ec5424c763f3dce0029d0b5ff5c47b94abdf7b (diff)
parentb9551862b4c01a4ff2991d296d875df92c53b026 (diff)
downloadvolse-hubzilla-1f5818cec875caaef60c62b03498e15835722a5a.tar.gz
volse-hubzilla-1f5818cec875caaef60c62b03498e15835722a5a.tar.bz2
volse-hubzilla-1f5818cec875caaef60c62b03498e15835722a5a.zip
Merge https://github.com/redmatrix/hubzilla into pending_merge
Diffstat (limited to 'include')
-rw-r--r--include/photo/photo_driver.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 32b9bd302..810e0cdc7 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -546,11 +546,18 @@ function guess_image_type($filename, $headers = '') {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$ph = photo_factory('');
$types = $ph->supportedTypes();
- $type = "image/jpeg";
foreach ($types as $m=>$e){
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;