MediaWiki  master
MWFileProps Class Reference

MimeMagic helper wrapper. More...

Collaboration diagram for MWFileProps:

Public Member Functions

 __construct (MimeAnalyzer $magic)
 
 getPropsFromPath ( $path, $ext)
 Get an associative array containing information about a file with the given storage path. More...
 
 newPlaceholderProps ()
 Empty place holder props for non-existing files. More...
 

Private Member Functions

 extractImageSizeInfo (array $gis)
 Exract image size information. More...
 

Private Attributes

MimeAnalyzer $magic
 

Detailed Description

MimeMagic helper wrapper.

Since
1.28

Definition at line 28 of file MWFileProps.php.

Constructor & Destructor Documentation

◆ __construct()

MWFileProps::__construct ( MimeAnalyzer  $magic)
Parameters
MimeAnalyzer$magic

Definition at line 35 of file MWFileProps.php.

References $magic.

Member Function Documentation

◆ extractImageSizeInfo()

MWFileProps::extractImageSizeInfo ( array  $gis)
private

Exract image size information.

Parameters
array$gis
Returns
array

Definition at line 102 of file MWFileProps.php.

Referenced by getPropsFromPath().

◆ getPropsFromPath()

MWFileProps::getPropsFromPath (   $path,
  $ext 
)

Get an associative array containing information about a file with the given storage path.

Resulting array fields include:

  • fileExists
  • size (filesize in bytes)
  • mime (as major/minor)
  • media_type (value to be used with the MEDIATYPE_xxx constants)
  • metadata (handler specific)
  • sha1 (in base 36)
  • width
  • height
  • bits (bitrate)
  • file-mime
  • major_mime
  • minor_mime
Parameters
string$pathFilesystem path to a file
string | bool$extThe file extension, or true to extract it from the filename. Set it to false to ignore the extension.
Returns
array
Since
1.28

Definition at line 63 of file MWFileProps.php.

References $ext, $path, FileBackend\extensionFromPath(), extractImageSizeInfo(), MediaHandler\getHandler(), newPlaceholderProps(), File\splitMime(), and true.

◆ newPlaceholderProps()

MWFileProps::newPlaceholderProps ( )

Empty place holder props for non-existing files.

Resulting array fields include:

  • fileExists
  • size (filesize in bytes)
  • mime (as major/minor)
  • media_type (value to be used with the MEDIATYPE_xxx constants)
  • metadata (handler specific)
  • sha1 (in base 36)
  • width
  • height
  • bits (bitrate)
  • file-mime
  • major_mime
  • minor_mime
Returns
array
Since
1.28

Definition at line 132 of file MWFileProps.php.

References MEDIATYPE_UNKNOWN, and FSFile\placeholderProps().

Referenced by getPropsFromPath().

Member Data Documentation

◆ $magic

MimeAnalyzer MWFileProps::$magic
private

Definition at line 30 of file MWFileProps.php.

Referenced by __construct().


The documentation for this class was generated from the following file: