diff options
author | Max Kostikov <max@kostikov.co> | 2019-01-03 17:18:52 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-01-03 17:18:52 +0100 |
commit | 1c4a90626aca63d15fc1ce50339c8630702188e6 (patch) | |
tree | f5032b1bad7abf3515fae5b5126ad09ccf5eb2df | |
parent | 1a652b555f394638e6836dfb88e98b5c916bf4d0 (diff) | |
parent | 3bf1866f4a7a619cedb445cd3e8a2ef9e827fa46 (diff) | |
download | volse-hubzilla-1c4a90626aca63d15fc1ce50339c8630702188e6.tar.gz volse-hubzilla-1c4a90626aca63d15fc1ce50339c8630702188e6.tar.bz2 volse-hubzilla-1c4a90626aca63d15fc1ce50339c8630702188e6.zip |
Merge branch 'revert-3f61d24d' into 'dev'
Revert "Merge branch 'check_content_type' into 'dev'"
See merge request hubzilla/core!1456
-rw-r--r-- | include/photo/photo_driver.php | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 608237ce1..9aeb2ef17 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -482,6 +482,7 @@ function guess_image_type($filename, $headers = '') { // logger('Photo: guess_image_type: '.$filename . ($headers?' from curl headers':''), LOGGER_DEBUG); $type = null; if ($headers) { + $hdrs=array(); $h = explode("\n",$headers); foreach ($h as $l) { @@ -489,16 +490,11 @@ function guess_image_type($filename, $headers = '') { $hdrs[strtolower($k)] = $v; } logger('Curl headers: '.var_export($hdrs, true), LOGGER_DEBUG); - if (array_key_exists('content-type', $hdrs)) { + if (array_key_exists('content-type', $hdrs)) $type = $hdrs['content-type']; - - $ph = photo_factory(''); - $types = $ph->supportedTypes(); - - $type = $types[$type]; - } } if (is_null($type)){ + $ignore_imagick = get_config('system', 'ignore_imagick'); // Guessing from extension? Isn't that... dangerous? if(class_exists('Imagick') && file_exists($filename) && is_readable($filename) && !$ignore_imagick) { @@ -642,6 +638,7 @@ function import_xchan_photo($photo,$xchan,$thing = false,$force = false) { $img_str = $result['body']; $type = guess_image_type($photo, $result['header']); $modified = gmdate('Y-m-d H:i:s', (preg_match('/last-modified: (.+) \S+/i', $result['header'], $o) ? strtotime($o[1] . 'Z') : time())); + if(is_null($type)) $photo_failure = true; } |