1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 17:19:50 +02:00

Include jp2k as jpeg2000 extension

This commit is contained in:
Oliver Vogel
2025-01-16 16:10:56 +01:00
parent cde28943a5
commit f70142152b
4 changed files with 9 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ enum FileExtension: string
case TIFF = 'tiff'; case TIFF = 'tiff';
case JP2 = 'jp2'; case JP2 = 'jp2';
case J2K = 'j2k'; case J2K = 'j2k';
case JP2K = 'jp2k';
case JPF = 'jpf'; case JPF = 'jpf';
case JPM = 'jpm'; case JPM = 'jpm';
case JPG2 = 'jpg2'; case JPG2 = 'jpg2';
@@ -44,6 +45,7 @@ enum FileExtension: string
self::TIF, self::TIF,
self::TIFF => Format::TIFF, self::TIFF => Format::TIFF,
self::JP2, self::JP2,
self::JP2K,
self::J2K, self::J2K,
self::JPF, self::JPF,
self::JPM, self::JPM,

View File

@@ -76,6 +76,9 @@ final class FileExtensionTest extends BaseTestCase
$ext = FileExtension::JPG2; $ext = FileExtension::JPG2;
$this->assertEquals(Format::JP2, $ext->format()); $this->assertEquals(Format::JP2, $ext->format());
$ext = FileExtension::JP2K;
$this->assertEquals(Format::JP2, $ext->format());
} }
public function testFormatHeic(): void public function testFormatHeic(): void

View File

@@ -271,7 +271,7 @@ final class FormatTest extends BaseTestCase
$format = Format::JP2; $format = Format::JP2;
$extensions = $format->fileExtensions(); $extensions = $format->fileExtensions();
$this->assertIsArray($extensions); $this->assertIsArray($extensions);
$this->assertCount(8, $extensions); $this->assertCount(9, $extensions);
$this->assertEquals(FileExtension::JP2, $format->fileExtension()); $this->assertEquals(FileExtension::JP2, $format->fileExtension());
} }

View File

@@ -143,9 +143,9 @@ final class MediaTypeTest extends BaseTestCase
yield [MediaType::IMAGE_X_WIN_BITMAP, 1, FileExtension::BMP]; yield [MediaType::IMAGE_X_WIN_BITMAP, 1, FileExtension::BMP];
yield [MediaType::IMAGE_X_XBITMAP, 1, FileExtension::BMP]; yield [MediaType::IMAGE_X_XBITMAP, 1, FileExtension::BMP];
yield [MediaType::IMAGE_TIFF, 2, FileExtension::TIF]; yield [MediaType::IMAGE_TIFF, 2, FileExtension::TIF];
yield [MediaType::IMAGE_JP2, 8, FileExtension::JP2]; yield [MediaType::IMAGE_JP2, 9, FileExtension::JP2];
yield [MediaType::IMAGE_JPX, 8, FileExtension::JP2]; yield [MediaType::IMAGE_JPX, 9, FileExtension::JP2];
yield [MediaType::IMAGE_JPM, 8, FileExtension::JP2]; yield [MediaType::IMAGE_JPM, 9, FileExtension::JP2];
yield [MediaType::IMAGE_HEIC, 2, FileExtension::HEIC]; yield [MediaType::IMAGE_HEIC, 2, FileExtension::HEIC];
yield [MediaType::IMAGE_X_HEIC, 2, FileExtension::HEIC]; yield [MediaType::IMAGE_X_HEIC, 2, FileExtension::HEIC];
yield [MediaType::IMAGE_HEIF, 2, FileExtension::HEIC]; yield [MediaType::IMAGE_HEIF, 2, FileExtension::HEIC];