Improved Mime Type detection
This commit is contained in:
parent
248a7fa48a
commit
d3722c945b
9 changed files with 89 additions and 102 deletions
|
@ -706,9 +706,7 @@ function photos_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if ($type == "") {
|
||||
$type = Images::guessType($filename);
|
||||
}
|
||||
$type = Images::getMimeTypeBySource($src, $filename, $type);
|
||||
|
||||
Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', Logger::DEBUG);
|
||||
|
||||
|
|
|
@ -174,23 +174,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
exit();
|
||||
}
|
||||
|
||||
// This is a special treatment for picture upload from Twidere
|
||||
if (($filename == "octet-stream") && ($filetype != "")) {
|
||||
$filename = $filetype;
|
||||
$filetype = "";
|
||||
}
|
||||
|
||||
if ($filetype == "") {
|
||||
$filetype = Images::guessType($filename);
|
||||
}
|
||||
|
||||
// If there is a temp name, then do a manual check
|
||||
// This is more reliable than the provided value
|
||||
|
||||
$imagedata = getimagesize($src);
|
||||
if ($imagedata) {
|
||||
$filetype = $imagedata['mime'];
|
||||
}
|
||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
||||
|
||||
Logger::log("File upload src: " . $src . " - filename: " . $filename .
|
||||
" - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue