public static getMimetype ( string $path ) : string | ||
$path | string | |
return | string |
public static function getMimetype(string $path) : string
{
$finfo = new Finfo(FILEINFO_MIME_TYPE);
return $finfo->file($path);
}
public function canConvert(Media $media) : bool { if (!$this->requirementsAreInstalled()) { return false; } if ($this->supportedExtensions()->contains(strtolower($media->extension))) { return true; } $urlGenerator = UrlGeneratorFactory::createForMedia($media); if (method_exists($urlGenerator, 'getPath') && file_exists($media->getPath()) && $this->supportedMimetypes()->contains(strtolower(File::getMimetype($media->getPath())))) { return true; } return false; }