Add a secret 'static' media engine for fast unit testing

This commit is contained in:
Shish 2020-01-28 22:23:03 +00:00
parent 615da9e9d2
commit 7472d6faf0
3 changed files with 20 additions and 7 deletions

View file

@ -236,6 +236,9 @@ class Media extends Extension
);
//}
break;
case MediaEngine::STATIC:
copy($event->input_path, $event->output_path);
break;
default:
throw new MediaException("Engine not supported for resize: " . $event->engine);
}

View file

@ -5,11 +5,13 @@ 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::IMAGICK,
MediaEngine::STATIC,
];
public const OUTPUT_SUPPORT = [
MediaEngine::GD => [
@ -30,8 +32,11 @@ abstract class MediaEngine
MediaEngine::FFMPEG => [
"jpg",
"webp",
"png"
]
"png",
],
MediaEngine::STATIC => [
"jpg",
],
];
public const INPUT_SUPPORT = [
MediaEngine::GD => [
@ -41,7 +46,7 @@ abstract class MediaEngine
"png",
"webp",
Media::WEBP_LOSSY,
Media::WEBP_LOSSLESS
Media::WEBP_LOSSLESS,
],
MediaEngine::IMAGICK => [
"bmp",
@ -61,7 +66,12 @@ abstract class MediaEngine
"webm",
"mp4",
"mov",
"flv"
]
"flv",
],
MediaEngine::STATIC => [
"jpg",
"gif",
"png",
],
];
}

View file

@ -23,7 +23,7 @@ require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.
_load_theme_files();
$page = new Page();
_load_event_listeners();
$config->set_string("thumb_engine", "gd"); # GD has less overhead per-call
$config->set_string("thumb_engine", "static"); # GD has less overhead per-call
send_event(new DatabaseUpgradeEvent());
send_event(new InitExtEvent());