Changed mime type map to deal with the reality that certain file types have multiple extensions and/or multiple mime types, as well as constants supporting all of the data. Created new functions using the updated mime type map to resolve mime types and extensions. Updated various items around the project that determine mime/extension to take advantage of the new functions.
		
			
				
	
	
		
			78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php declare(strict_types=1);
 | |
| 
 | |
| abstract class MediaEngine
 | |
| {
 | |
|     public const GD = "gd";
 | |
|     public const IMAGICK = "convert";
 | |
|     public const FFMPEG = "ffmpeg";
 | |
|     public const STATIC = "static";
 | |
| 
 | |
|     public const ALL = [
 | |
|         MediaEngine::GD,
 | |
|         MediaEngine::FFMPEG,
 | |
|         MediaEngine::IMAGICK,
 | |
|         MediaEngine::STATIC,
 | |
|     ];
 | |
|     public const OUTPUT_SUPPORT = [
 | |
|         MediaEngine::GD => [
 | |
|             EXTENSION_GIF,
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_PNG,
 | |
|             EXTENSION_WEBP,
 | |
|             Media::WEBP_LOSSY,
 | |
|         ],
 | |
|         MediaEngine::IMAGICK => [
 | |
|             EXTENSION_GIF,
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_PNG,
 | |
|             EXTENSION_WEBP,
 | |
|             Media::WEBP_LOSSY,
 | |
|             Media::WEBP_LOSSLESS,
 | |
|         ],
 | |
|         MediaEngine::FFMPEG => [
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_WEBP,
 | |
|             EXTENSION_PNG,
 | |
|         ],
 | |
|         MediaEngine::STATIC => [
 | |
|             EXTENSION_JPG,
 | |
|         ],
 | |
|     ];
 | |
|     public const INPUT_SUPPORT = [
 | |
|         MediaEngine::GD => [
 | |
|             EXTENSION_BMP,
 | |
|             EXTENSION_GIF,
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_PNG,
 | |
|             EXTENSION_WEBP,
 | |
|             Media::WEBP_LOSSY,
 | |
|             Media::WEBP_LOSSLESS,
 | |
|         ],
 | |
|         MediaEngine::IMAGICK => [
 | |
|             EXTENSION_BMP,
 | |
|             EXTENSION_GIF,
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_PNG,
 | |
|             EXTENSION_PSD,
 | |
|             EXTENSION_TIFF,
 | |
|             EXTENSION_WEBP,
 | |
|             Media::WEBP_LOSSY,
 | |
|             Media::WEBP_LOSSLESS,
 | |
|             EXTENSION_ICO,
 | |
|         ],
 | |
|         MediaEngine::FFMPEG => [
 | |
|             EXTENSION_AVI,
 | |
|             EXTENSION_MKV,
 | |
|             EXTENSION_WEBM,
 | |
|             EXTENSION_MP4,
 | |
|             EXTENSION_MOV,
 | |
|             EXTENSION_FLASH_VIDEO,
 | |
|         ],
 | |
|         MediaEngine::STATIC => [
 | |
|             EXTENSION_JPG,
 | |
|             EXTENSION_GIF,
 | |
|             EXTENSION_PNG,
 | |
|         ],
 | |
|     ];
 | |
| }
 |