This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/media/media_engine.php
Matthew Barbour 63b2601e67 Mime type handling overhaul
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.
2020-06-03 19:47:40 +01:00

77 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,
],
];
}