mirror of
https://github.com/friendica/friendica
synced 2025-05-14 07:04:11 +02:00
Image handling reworked, new image formats added (#13900)
* Image handling reworked, new image formats added * Updated messages.po * The dot is now part of the file extension * Added WebP in install documentation * Handle unhandled mime types * Fixed animated picture detected
This commit is contained in:
parent
1ea8a4042d
commit
14e5b06029
31 changed files with 541 additions and 386 deletions
|
@ -99,8 +99,7 @@ class Browser extends BaseModule
|
|||
|
||||
protected function map_files(array $record): array
|
||||
{
|
||||
$types = Images::supportedTypes();
|
||||
$ext = $types[$record['type']];
|
||||
$ext = Images::getExtensionByMimeType($record['type']);
|
||||
$filename_e = $record['filename'];
|
||||
|
||||
// Take the largest picture that is smaller or equal 640 pixels
|
||||
|
@ -118,7 +117,7 @@ class Browser extends BaseModule
|
|||
return [
|
||||
sprintf('%s/photos/%s/image/%s', $this->baseUrl, $this->app->getLoggedInUserNickname(), $record['resource-id']),
|
||||
$filename_e,
|
||||
sprintf('%s/photo/%s-%s.%s', $this->baseUrl, $record['resource-id'], $scale, $ext),
|
||||
sprintf('%s/photo/%s-%s%s', $this->baseUrl, $record['resource-id'], $scale, $ext),
|
||||
$record['desc'],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -135,8 +135,6 @@ class Upload extends \Friendica\BaseModule
|
|||
$this->return(401, $this->t('Invalid request.'), true);
|
||||
}
|
||||
|
||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
||||
|
||||
$this->logger->info('File upload:', [
|
||||
'src' => $src,
|
||||
'filename' => $filename,
|
||||
|
@ -145,7 +143,7 @@ class Upload extends \Friendica\BaseModule
|
|||
]);
|
||||
|
||||
$imagedata = @file_get_contents($src);
|
||||
$image = new Image($imagedata, $filetype);
|
||||
$image = new Image($imagedata, $filetype, $filename);
|
||||
|
||||
if (!$image->isValid()) {
|
||||
@unlink($src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue