diff --git a/Dockerfile b/Dockerfile index 74275e7fe..b9771f756 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,13 @@ FROM unit:php8.3 AS base RUN apt update && \ apt upgrade -y && \ apt install -y --no-install-recommends \ - curl rsync imagemagick zip unzip libpq-dev libpng-dev libjpeg-dev libzip-dev libwebp-dev && \ + curl rsync imagemagick zip unzip libpq-dev libpng-dev libjpeg-dev libzip-dev libwebp-dev libavif-dev && \ rm -rf /var/lib/apt/lists/* RUN pecl install redis-6.1.0 && docker-php-ext-enable redis RUN pecl install apcu-5.1.24 && docker-php-ext-enable apcu RUN apt-get update && apt-get install -y libmemcached-dev libssl-dev zlib1g-dev && \ pecl install memcached-3.3.0 && docker-php-ext-enable memcached -RUN docker-php-ext-configure gd --with-jpeg --with-webp && \ +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-avif && \ docker-php-ext-install gd RUN docker-php-ext-install mysqli pgsql pdo pdo_mysql pdo_pgsql zip pcntl diff --git a/ext/handle_pixel/info.php b/ext/handle_pixel/info.php index 2f79ad8e7..28e4c49db 100644 --- a/ext/handle_pixel/info.php +++ b/ext/handle_pixel/info.php @@ -13,6 +13,6 @@ class PixelFileHandlerInfo extends ExtensionInfo public string $url = self::SHIMMIE_URL; public array $authors = self::SHISH_AUTHOR; public ExtensionCategory $category = ExtensionCategory::FILE_HANDLING; - public string $description = "Handle JPEG, PNG, GIF, WEBP, etc files"; + public string $description = "Handle JPEG, PNG, GIF, and similar files"; public bool $core = true; } diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index 9c89e4d3d..decba730b 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -6,7 +6,13 @@ class PixelFileHandler extends DataHandlerExtension { - protected array $SUPPORTED_MIME = [MimeType::JPEG, MimeType::GIF, MimeType::PNG, MimeType::WEBP]; + protected array $SUPPORTED_MIME = [ + MimeType::JPEG, + MimeType::GIF, + MimeType::PNG, + MimeType::WEBP, + MimeType::AVIF, + ]; protected function media_check_properties(MediaCheckPropertiesEvent $event): void { @@ -37,7 +43,7 @@ protected function media_check_properties(MediaCheckPropertiesEvent $event): voi protected function check_contents(string $tmpname): bool { - $valid = [IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_WEBP]; + $valid = [IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_WEBP, IMAGETYPE_AVIF]; $info = getimagesize($tmpname); return $info && in_array($info[2], $valid); } diff --git a/ext/handle_pixel/test.php b/ext/handle_pixel/test.php index 10366d31b..0d6b3fe17 100644 --- a/ext/handle_pixel/test.php +++ b/ext/handle_pixel/test.php @@ -29,6 +29,8 @@ public static function formatList(): array ["jpeg"], ["png"], ["gif"], + ["webp"], + ["avif"], ]; } diff --git a/ext/media/media_engine.php b/ext/media/media_engine.php index 191d3259d..d3c64bed7 100644 --- a/ext/media/media_engine.php +++ b/ext/media/media_engine.php @@ -27,7 +27,8 @@ abstract class MediaEngine MimeType::GIF, MimeType::JPEG, MimeType::PNG, - MimeType::WEBP + MimeType::WEBP, + MimeType::AVIF, ], MediaEngine::IMAGICK => [ MimeType::GIF, @@ -35,6 +36,7 @@ abstract class MediaEngine MimeType::PNG, MimeType::WEBP, MimeType::WEBP_LOSSLESS, + MimeType::AVIF, ], MediaEngine::FFMPEG => [ MimeType::JPEG, @@ -54,6 +56,7 @@ abstract class MediaEngine MimeType::TGA, MimeType::WEBP, MimeType::WEBP_LOSSLESS, + MimeType::AVIF, ], MediaEngine::IMAGICK => [ MimeType::BMP, @@ -67,6 +70,7 @@ abstract class MediaEngine MimeType::WEBP, MimeType::WEBP_LOSSLESS, MimeType::ICO, + MimeType::AVIF, ], MediaEngine::FFMPEG => [ MimeType::AVI, @@ -80,6 +84,7 @@ abstract class MediaEngine MimeType::JPEG, MimeType::GIF, MimeType::PNG, + MimeType::AVIF, ], ]; public const RESIZE_TYPE_SUPPORT = [ diff --git a/ext/mime/file_extension.php b/ext/mime/file_extension.php index 2526939e7..3b714449d 100644 --- a/ext/mime/file_extension.php +++ b/ext/mime/file_extension.php @@ -11,6 +11,7 @@ class FileExtension public const ASF = 'asf'; public const ASX = 'asx'; public const AVI = 'avi'; + public const AVIF = 'avif'; public const BMP = 'bmp'; public const BZIP = 'bz'; public const BZIP2 = 'bz2'; diff --git a/ext/mime/mime_map.php b/ext/mime/mime_map.php index 325869eb8..e342e13b7 100644 --- a/ext/mime/mime_map.php +++ b/ext/mime/mime_map.php @@ -28,6 +28,11 @@ class MimeMap self::MAP_EXT => [FileExtension::AVI], self::MAP_MIME => [MimeType::AVI, 'video/avi', 'video/msvideo'], ], + MimeType::AVIF => [ + self::MAP_NAME => "AVIF", + self::MAP_EXT => [FileExtension::AVIF], + self::MAP_MIME => [MimeType::AVIF], + ], MimeType::ASF => [ self::MAP_NAME => "ASF/WMV", self::MAP_EXT => [FileExtension::ASF, FileExtension::ASX, FileExtension::WMA, FileExtension::WMV], diff --git a/ext/mime/mime_type.php b/ext/mime/mime_type.php index ad7aba39b..bf178b3d5 100644 --- a/ext/mime/mime_type.php +++ b/ext/mime/mime_type.php @@ -12,6 +12,7 @@ class MimeType public const ANI = 'application/riff+ani'; public const ASF = 'video/x-ms-asf'; public const AVI = 'video/x-msvideo'; + public const AVIF = 'image/avif'; // Went with mime types from http://fileformats.archiveteam.org/wiki/Comic_Book_Archive public const COMIC_ZIP = 'application/vnd.comicbook+zip'; public const COMIC_RAR = 'application/vnd.comicbook-rar';