mirror of
https://github.com/friendica/friendica
synced 2025-05-05 18:24:10 +02:00
Fix the handling of unhandled image types and of animations (#13904)
* Fix the handling of unhandled image types and of animations * Avoid warnings
This commit is contained in:
parent
7d10518e94
commit
08fa51d0bb
4 changed files with 23 additions and 8 deletions
|
@ -183,6 +183,21 @@ class Images
|
|||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided mime type can be handled for resizing.
|
||||
* Only with Imagick installed, animated GIF and WebP keep their animation after resize.
|
||||
*
|
||||
* @param string $mimetype
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canResize(string $mimetype): bool
|
||||
{
|
||||
if (in_array(self::getImageTypeByMimeType($mimetype), [IMAGETYPE_GIF, IMAGETYPE_WEBP])) {
|
||||
return class_exists('Imagick');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch image mimetype from the image data or guessing from the file name
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue