Exemplo n.º 1
0
 /**
  * Get the mime-type from a given path or content
  *
  * @param string $path
  * @param string|resource $content
  * @return string
  */
 private function getMimeType($path, $content)
 {
     if (is_resource($content)) {
         $meta = stream_get_meta_data($content);
         $ext = pathinfo($meta['uri'], PATHINFO_EXTENSION);
         $map = MimeType::getExtensionToMimeTypeMap();
         if (isset($map[$ext])) {
             return $map[$ext];
         } else {
             return '';
         }
     } else {
         return Util::guessMimeType($path, $content);
     }
 }