mirror of
https://github.com/friendica/friendica
synced 2025-04-27 17:10:10 +00: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
|
@ -184,8 +184,6 @@ class Photos extends \Friendica\Module\BaseProfile
|
|||
return;
|
||||
}
|
||||
|
||||
$type = Images::getMimeTypeBySource($src, $filename, $type);
|
||||
|
||||
$this->logger->info('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes');
|
||||
|
||||
$maximagesize = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize'));
|
||||
|
@ -210,7 +208,7 @@ class Photos extends \Friendica\Module\BaseProfile
|
|||
|
||||
$imagedata = @file_get_contents($src);
|
||||
|
||||
$image = new Image($imagedata, $type);
|
||||
$image = new Image($imagedata, $type, $filename);
|
||||
|
||||
if (!$image->isValid()) {
|
||||
$this->logger->notice('unable to process image');
|
||||
|
@ -341,14 +339,12 @@ class Photos extends \Friendica\Module\BaseProfile
|
|||
$pager->getItemsPerPage()
|
||||
));
|
||||
|
||||
$phototypes = Images::supportedTypes();
|
||||
|
||||
$photos = array_map(function ($photo) use ($phototypes) {
|
||||
$photos = array_map(function ($photo){
|
||||
return [
|
||||
'id' => $photo['id'],
|
||||
'link' => 'photos/' . $this->owner['nickname'] . '/image/' . $photo['resource-id'],
|
||||
'title' => $this->t('View Photo'),
|
||||
'src' => 'photo/' . $photo['resource-id'] . '-' . ((($photo['scale']) == 6) ? 4 : $photo['scale']) . '.' . $phototypes[$photo['type']],
|
||||
'src' => 'photo/' . $photo['resource-id'] . '-' . ((($photo['scale']) == 6) ? 4 : $photo['scale']) . Images::getExtensionByMimeType($photo['type']),
|
||||
'alt' => $photo['filename'],
|
||||
'album' => [
|
||||
'link' => 'photos/' . $this->owner['nickname'] . '/album/' . bin2hex($photo['album']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue