getMimetype() public static method

* Get the mime type of a file.
public static getMimetype ( string $path ) : string
$path string
return string
 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;
 }
Beispiel #2
0
 public function getMimeAttribute() : string
 {
     return File::getMimetype($this->getPath());
 }