From c66fa7dac8051e4cf88909e2834509f3dcd003fc Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Mon, 30 Dec 2024 09:45:35 +0100 Subject: [PATCH] Add 'image/x-jp2-codestream' as Jpeg2000 mime type --- src/MediaType.php | 2 ++ tests/Unit/FileExtensionTest.php | 2 +- tests/Unit/FormatTest.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MediaType.php b/src/MediaType.php index 71dc5732..0ae1b76c 100644 --- a/src/MediaType.php +++ b/src/MediaType.php @@ -27,6 +27,7 @@ enum MediaType: string case IMAGE_X_XBITMAP = 'image/x-xbitmap'; case IMAGE_TIFF = 'image/tiff'; case IMAGE_JP2 = 'image/jp2'; + case IMAGE_X_JP2_CODESTREAM = 'image/x-jp2-codestream'; case IMAGE_JPX = 'image/jpx'; case IMAGE_JPM = 'image/jpm'; case IMAGE_HEIC = 'image/heic'; @@ -63,6 +64,7 @@ enum MediaType: string self::IMAGE_TIFF => Format::TIFF, self::IMAGE_JP2, self::IMAGE_JPX, + self::IMAGE_X_JP2_CODESTREAM, self::IMAGE_JPM => Format::JP2, self::IMAGE_HEIF, self::IMAGE_HEIC, diff --git a/tests/Unit/FileExtensionTest.php b/tests/Unit/FileExtensionTest.php index 65b907ba..69051264 100644 --- a/tests/Unit/FileExtensionTest.php +++ b/tests/Unit/FileExtensionTest.php @@ -104,7 +104,7 @@ final class FileExtensionTest extends BaseTestCase yield [FileExtension::BMP, 8, MediaType::IMAGE_BMP]; yield [FileExtension::TIFF, 1, MediaType::IMAGE_TIFF]; yield [FileExtension::TIF, 1, MediaType::IMAGE_TIFF]; - yield [FileExtension::JP2, 3, MediaType::IMAGE_JP2]; + yield [FileExtension::JP2, 4, MediaType::IMAGE_JP2]; yield [FileExtension::HEIC, 3, MediaType::IMAGE_HEIC]; } } diff --git a/tests/Unit/FormatTest.php b/tests/Unit/FormatTest.php index 5c405025..4697f5d2 100644 --- a/tests/Unit/FormatTest.php +++ b/tests/Unit/FormatTest.php @@ -127,7 +127,7 @@ final class FormatTest extends BaseTestCase $format = Format::JP2; $mediaTypes = $format->mediaTypes(); $this->assertIsArray($mediaTypes); - $this->assertCount(3, $mediaTypes); + $this->assertCount(4, $mediaTypes); $this->assertEquals(MediaType::IMAGE_JP2, $format->mediaType()); }