Class: I2CE MimeTypes

From IHRIS Wiki
Revision as of 22:53, 16 October 2009 by Litlfred (talk | contribs)

This article desrcibes the class I2CE_MimeTypes. It is contained in the module MimeTypes in the package I2CE

The class is defined in the file: modules/MimeTypes/lib/I2CE_MimeTypes.php

class that will handle trying to figure out mime types in various ways.

  • Author: Carl Leitner <litlfred@ibiblio.org>

Variables

$finfo

protected static @var finfo $finfo. See http://us2.php.net/fileinfo

  • Type: static protected $finfo

$extToMimeTypes

protected static @var array $extToMimeTypes an array with keys file extensions and values mime types

  • Type: static protected $extToMimeTypes

Methods

extToMimeType()

Given a file extension, it determine the mime-type

  • Signature: static public function extToMimeType($ext)
  • Returns: string The mime-type, or null if not found.

Parameters:

  • string $ext
    Either a file name or extension

loadMimeTypes()

Loads in the file containing mime types and extensions

  • Signature: static protected function loadMimeTypes()

magicMimeType()

Tries to determine the file type magically

  • Signature: static public function magicMimeType($data)
  • Returns: a string, the mime type, or null if none was found.

Parameters:

mimeTypeToExt()

Get a file extension for the associated mime type

  • Signature: static public function mimeTypeToExt($mime_type)
  • Returns: mixed. String, the extension, on success, false on failure

Parameters: