MediaWiki  1.28.0
MWFileProps Class Reference

MimeMagic helper wrapper. More...

Collaboration diagram for MWFileProps:

Public Member Functions

 __construct (MimeMagic $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

MimeMagic $magic
 

Detailed Description

MimeMagic helper wrapper.

Since
1.28

Definition at line 28 of file MWFileProps.php.

Constructor & Destructor Documentation

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

Definition at line 35 of file MWFileProps.php.

References $magic.

Member Function Documentation

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().

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, $handler, $path, FileBackend\extensionFromPath(), extractImageSizeInfo(), MediaHandler\getHandler(), list, newPlaceholderProps(), File\splitMime(), and true.

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 136 of file MWFileProps.php.

References MEDIATYPE_UNKNOWN, and FSFile\placeholderProps().

Referenced by getPropsFromPath().

Member Data Documentation

MimeMagic 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: