View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_Mime_Magic
{zone-data}

{zone-data:proposer-list}
[~mratzloff]
{zone-data}

{zone-data:revision}
0.1 - March 9, 2007: Posted initial proposal
{zone-data}

{zone-data:overview}
{{Zend_Mime_Magic}} attempts to detect the MIME type of a file by comparing the file's byte signature to known "magic" values. By implementing it natively in PHP, it is cross-platform without the need to install the {{Fileinfo}} extension or rely on the (deprecated) {{mime_content_type()}} function. This makes installation of open-source software that relies on MIME type detection easier, because no server configuration changes are required. Also, because it uses the standard Linux magic file format, users can substitute their own magic.mime file if they wish, or add custom rules they find on the Web.
{zone-data}

{zone-data:references}
* [Apache documentation for mod_mime_magic|http://httpd.apache.org/docs/2.0/mod/mod_mime_magic.html] - A brief overview of the magic file format
{zone-data}

{zone-data:requirements}
* This component *will* attempt to discern the correct file type for a given file.
* This component *will* be compatible with the standard magic.mime file format, common to most Linux installations.
* This component *will not* be compatible with the (inferior) magic.mime file that comes packaged with PHP.
* This component *will not* be as fast as a C extension, but will not be prohibitively slow.
* This component *will* be completely serializable, to allow user-level caching. This will increase its speed and ease of use.
{zone-data}

{zone-data:dependencies}
* Zend_Exception
{zone-data}

{zone-data:operation}
See use cases.
{zone-data}

{zone-data:milestones}
* Milestone 1: *\[DONE\]* Working prototype exists.
* Milestone 2: [Design notes will be published here|http://framework.zend.com/wiki/x/sg]
* Milestone 3: Prototype checked into the incubator.
* Milestone 4: Unit tests exist, work, and are checked into Subversion.
* Milestone 5: Initial documentation exists.
{zone-data}

{zone-data:class-list}
* Zend_Mime_Magic
* Zend_Mime_Magic_Exception
* Zend_Mime_Magic_Parser
* Zend_Mime_Magic_Test
* Zend_Mime_Magic_Test_Result
{zone-data}

{zone-data:use-cases}
||UC-01||

{code:php}
$magic = new Zend_Mime_Magic();
$mimeType = $magic->getMimeType($uploadedFile);
{code}

||UC-02||

{code:php}
$magic = new Zend_Mime_Magic();
if (!$magic->isMimeType($uploadedFile, 'application/msword')) {
// reject download
}
{code}
{zone-data}

{zone-data:skeletons}
{code:php}
class Zend_Mime_Magic implements Serializable
{
protected $_magicFilename = 'Zend/Mime/Magic/Data/magic.mime';
protected $_tests = array();

public function __construct($magicFilename = '');
public function getMimeType($filename);
public function isMimeType($filename, $acceptableMimeType); // string or array
public function serialize();
public function unserialize($serialized);
}

class Zend_Mime_Magic_Exception extends Zend_Exception
{
}

class Zend_Mime_Magic_Parser
{
static protected $_methods;

public function __construct();
public function parse($filename);
protected function _prepareContents($contents);
protected function _splitLines($contents);
protected function _splitFields($lines);
protected function _createTests(array $array);
}

class Zend_Mime_Magic_Test
{
static protected $_methods = array(
'belong' => 4,
'beshort' => 2,
'byte' => 1,
'lelong' => 4,
'leshort' => 2,
'long' => 4,
'short' => 2,
'ubyte' => 1
);

/** @var int Continuation depth */
protected $_depth = 0;

/** @var int Byte offset */
protected $_offset = null;

/** @var string Method for signature comparison */
protected $_method = null;

/** @var mixed Data type modifier; usually a bitmask, but not always */
protected $_modifier = null;

/** @var mixed Byte or string signature */
protected $_signature = null;

/** @var string Bitwise operator */
protected $_operator = null;

/** @var string Likely MIME type */
protected $_mimeType = null;

/** @var string Encoding, but sometimes a type differentiator */
protected $_encoding = null;

/** @var int Line number of test in magic file */
protected $_lineNumber = null;

/** @var int Line number to go to on success; false if EOF reached */
protected $_lineNumberOnSuccess = null;

/** @var int Line number to go to on failure; false if EOF reached */
protected $_lineNumberOnFailure = null;

public function __construct(array $array, $lineNumber);
public function examine($file);
public function setLineNumberOnSuccess($lineNumberOnSuccess);
public function getLineNumberOnSuccess();
public function setLineNumberOnFailure($lineNumberOnFailure);
public function getLineNumberOnFailure();
public function serialize();
public function unserialize($serialized);
protected function _equalsString($file);
protected function _containsString($file);
protected function _equalsNumber($file);
protected function _readBytes($file, $offset, $length = 32);
}

class Zend_Mime_Magic_Test_Result
{
/** @var bool Did the test match? */
protected $_isMatch = false;

/** @var string MIME type of match, if found */
protected $_mimeType = false;

/** @var string Line number of next test to try */
protected $_nextLineNumber = false;

public function __construct($isMatch, $mimeType, $nextLineNumber);
public function isMatch();
public function getMimeType();
public function getNextLineNumber();
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>

<h2>10. Initial speed/accuracy comparisons:</h2>
<p><br class="atl-forced-newline" /></p>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{composition-setup}{composition-setup}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{deck:id=comparisons}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card:label=Zend_Mime_Magic}]]></ac:plain-text-body></ac:macro>
<h2>Zend_Mime_Magic</h2>

<table><tbody>
<tr>
<th><p>Filename</p></th>
<th><p>MIME type detected</p></th>
</tr>
<tr>
<td><p>3gpp.3gp</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (audio/3gpp)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>aac.mp4</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mp4 (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flac.flac</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-flac</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flash.swf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-shockwave-flash</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gif.gif</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/gif</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gzip.gz</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-gzip</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>html.html</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/html</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>id3.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>java.class</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-java-applet</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>jpeg.jpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/jpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.m4a</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.mp4</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mp3</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (audio/mpeg)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mpg</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg (video/mpeg)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>ogg.ogg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/ogg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>pdf.pdf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/pdf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>png.png</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/png</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>postscript.ps</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/postscript</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>real.rm</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/vnd.rn-realmedia</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>rtf.rtf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/rtf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>tar.tar</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-tar</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>wave.wav</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-wav</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>word.doc</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/msword</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>zip.zip</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/zip</p></ac:rich-text-body></ac:macro></td>
</tr>
</tbody></table>

<p>Time required to detect MIME types: 0.179646968842</p>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card:label=File(1)}]]></ac:plain-text-body></ac:macro>
<h2>File(1)</h2>

<table><tbody>
<tr>
<th><p>Filename</p></th>
<th><p>MIME type detected</p></th>
</tr>
<tr>
<td><p>3gpp.3gp</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/3gpp (audio/3gpp)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>aac.mp4</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mp4 (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flac.flac</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-flac</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flash.swf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-shockwave-flash</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gif.gif</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/gif</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gzip.gz</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-gzip</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>html.html</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/html</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>id3.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>java.class</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-java-applet</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>jpeg.jpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/jpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.m4a</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mp4</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.mp4</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mp4 (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>ogg.ogg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/ogg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>pdf.pdf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/pdf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>png.png</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/png</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>postscript.ps</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/postscript</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>real.rm</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/vnd.rn-realmedia</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>rtf.rtf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/rtf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>tar.tar</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-tar</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>wave.wav</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-wav</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>word.doc</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/msword</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>zip.zip</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/zip</p></ac:rich-text-body></ac:macro></td>
</tr>
</tbody></table>

<p>Time required to detect MIME types: 0.127838850021</p>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card:label=Fileinfo}]]></ac:plain-text-body></ac:macro>
<h2>Fileinfo</h2>

<table><tbody>
<tr>
<th><p>Filename</p></th>
<th><p>MIME type detected</p></th>
</tr>
<tr>
<td><p>3gpp.3gp</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/3gpp (audio/3gpp)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>aac.mp4</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mp4 (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flac.flac</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-flac</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flash.swf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-shockwave-flash</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gif.gif</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/gif</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gzip.gz</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-gzip</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>html.html</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/html</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>id3.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>java.class</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-java-applet</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>jpeg.jpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/jpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.m4a</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mp4</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.mp4</p></td>
<td><ac:macro ac:name="note"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mp4 (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>ogg.ogg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/ogg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>pdf.pdf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/pdf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>png.png</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/png</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>postscript.ps</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/postscript</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>real.rm</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/vnd.rn-realmedia</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>rtf.rtf</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/rtf</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>tar.tar</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-tar</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>wave.wav</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-wav</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>word.doc</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/msword</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>zip.zip</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/zip</p></ac:rich-text-body></ac:macro></td>
</tr>
</tbody></table>

<p>Time required to detect MIME types: 0.00791311264038</p>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card:label=mime_content_type() (deprecated)}]]></ac:plain-text-body></ac:macro>
<h2>mime_content_type() (deprecated)</h2>

<table><tbody>
<tr>
<th><p>Filename</p></th>
<th><p>MIME type detected</p></th>
</tr>
<tr>
<td><p>3gpp.3gp</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/3gpp)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>aac.mp4</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flac.flac</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/x-flac)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>flash.swf</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (application/x-shockwave-flash)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gif.gif</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/gif</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>gzip.gz</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-gzip</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>html.html</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/html</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>id3.mp3</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/mpeg)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>java.class</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (application/x-java-applet)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>jpeg.jpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/jpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.m4a</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mp4.mp4</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (audio/mp4, audio/mp4a-latm)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mp3</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>mpeg.mpg</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>video/mpeg</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>ogg.ogg</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (application/ogg)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>pdf.pdf</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (application/pdf)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>png.png</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>image/x-png (image/png)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>postscript.ps</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/postscript</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>real.rm</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-troff (application/vnd.rn-realmedia)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>rtf.rtf</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>? (text/rtf)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>tar.tar</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/x-gtar (application/x-tar)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>wave.wav</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>audio/x-wav</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>word.doc</p></td>
<td><ac:macro ac:name="warning"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>text/plain (application/msword)</p></ac:rich-text-body></ac:macro></td>
</tr>
<tr>
<td><p>zip.zip</p></td>
<td><ac:macro ac:name="tip"><ac:parameter ac:name="icon">false</ac:parameter><ac:rich-text-body><p>application/zip</p></ac:rich-text-body></ac:macro></td>
</tr>
</tbody></table>

<p>Time required to detect MIME types: 0.00289702415466</p>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{card}]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{deck}]]></ac:plain-text-body></ac:macro>