14use Psr\Log\LoggerInterface;
26 private const CORE_HANDLERS = [
27 'image/jpeg' => JpegHandler::class,
28 'image/png' => PNGHandler::class,
29 'image/gif' => GIFHandler::class,
30 'image/tiff' => TiffHandler::class,
31 'image/webp' => WebPHandler::class,
32 'image/x-ms-bmp' => BmpHandler::class,
33 'image/x-bmp' => BmpHandler::class,
34 'image/x-xcf' => XCFHandler::class,
35 'image/svg+xml' => SvgHandler::class,
36 'image/svg' => SvgHandler::class,
37 'image/vnd.djvu' => DjVuHandler::class,
38 'image/x.djvu' => DjVuHandler::class,
39 'image/x-djvu' => DjVuHandler::class,
40 'image/jp2' => Jpeg2000Handler::class,
41 'image/jpx' => Jpeg2000Handler::class,
49 private LoggerInterface $logger,
52 $this->registry = $registry + self::CORE_HANDLERS;
60 return $this->registry[$type] ??
false;
73 if ( $class !==
false ) {
75 $handler =
new $class;
76 if ( !$handler->isEnabled() ) {
78 '{class} is not enabled.',
82 } elseif ( $lang !==
null ) {
84 $lang = $this->langFactory->getLanguage( $lang );
86 $handler->setLanguage( $lang );
90 'no handler found for {type}.',
101class_alias( MediaHandlerFactory::class,
'MediaHandlerFactory' );