72 $info[
'fileExists'] = $fsFile->exists();
73 if ( $info[
'fileExists'] ) {
74 $info[
'size'] = $fsFile->getSize();
75 $info[
'sha1'] = $fsFile->getSha1Base36();
77 # MIME type according to file contents
78 $info[
'file-mime'] = $this->magic->guessMimeType(
$path,
false );
80 $ext = ( $ext === true ) ? FileBackend::extensionFromPath(
$path ) : (string)$ext;
82 # XXX: MimeAnalyzer::improveTypeFromExtension() may return null (T253483).
83 # Unclear if callers of this method expect that.
84 $info[
'mime'] = $this->magic->improveTypeFromExtension( $info[
'file-mime'], $ext );
86 [ $info[
'major_mime'], $info[
'minor_mime'] ] = File::splitMime( $info[
'mime'] );
87 $info[
'media_type'] = $this->magic->getMediaType(
$path, $info[
'mime'] );
89 # Height, width and metadata
91 $handler = MediaHandler::getHandler( $info[
'mime'] );
93 $sizeAndMetadata = $handler->getSizeAndMetadataWithFallback( $fsFile,
$path );
94 if ( $sizeAndMetadata ) {
95 $info = $sizeAndMetadata + $info;