'jpg', 'image/png' => 'png', 'image/webp' => 'webp', 'image/avif' => 'avif', )[ $mime ] ?? ''; } /** * A copy's type (WebP for copies of releases that recorded none). * * @param array $v The copy. * @return string The MIME type. */ public static function mime( array $v ): string { return $v['output_mime'] ?? 'image/webp'; } /** * Whether a name is one Image Manager gives its copy files. * * @param string $name The file name. * @return bool True when it is. */ public static function filename( string $name ): bool { return (bool) preg_match( '/^(?:t|d|w)?[1-9][0-9]*-[a-f0-9]{64}\.(?:webp|jpg|png|avif)$/D', $name ); } }