PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of wim niemans   Metyl PHP MIME Type Check   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: a simple demo
Class: Metyl PHP MIME Type Check
Check a file to detect its MIME type
Author: By
Last change: correction
Date: 2 years ago
Size: 1,214 bytes
 

Contents

Class file image Download
<?php

include 'metyl.class.php';
function
testMe($f) {
   
$result = metyl::make($f);
    echo
'fileName ' . $f;
    if (
$result->isValid()) {
        echo
" found! \n";
    } else {
        echo
" not suitable! \n";
    }
   
print_r($result);
}
testMe('Europa');
testMe(__FILE__);
exit;

/** Output of this :
fileName Europa found!
metyl Object
(
    [name] => Europa
    [baseName] => Europa
    [extension] => jpeg
    [mime] => image/jpeg; charset=binary
    [mimeType] => image/jpeg
    [encoding] => binary
    [message] =>
    [mappings] => Array
        (
            [0] => jpeg
            [1] => jpg
            [2] => jpe
            [3] => jfif
        )

    [errorsFound:protected] =>
)
fileName /Users/bonn/Desktop/P3/phpClasses/metyl/demo.php not suitable!
metyl Object
(
    [name] => /Users/bonn/Desktop/P3/phpClasses/metyl/demo.php
    [baseName] => demo.php
    [extension] => php
    [mime] => text/x-php; charset=us-ascii
    [mimeType] => text/x-php
    [encoding] => us-ascii
    [message] => extension php not like ???
    [mappings] => Array
        (
            [0] => ???
        )

    [errorsFound:protected] => 1
)
 */