예제 #1
0
 public function testGetDefaultExtensionIsBasedOnMimeType()
 {
     $file = new File(__DIR__ . '/Fixtures/test');
     $guesser = $this->createMockGuesser($file->getPath(), 'image/gif');
     MimeTypeGuesser::getInstance()->register($guesser);
     $this->assertEquals('.gif', $file->getDefaultExtension());
 }
예제 #2
0
파일: File.php 프로젝트: pgodel/PageRoller
 /**
  * Returns the mime type of the file.
  *
  * The mime type is guessed using the functions finfo(), mime_content_type()
  * and the system binary "file" (in this order), depending on which of those
  * is available on the current operating system.
  *
  * @returns string  The guessed mime type, e.g. "application/pdf"
  */
 public function getMimeType()
 {
     $guesser = MimeTypeGuesser::getInstance();
     return $guesser->guess($this->getPath());
 }