Exemple #1
0
    Type::config('magic', ['adapter' => 'Fileinfo']);
} else {
    Type::config('magic', ['adapter' => 'Freedesktop', 'file' => __DIR__ . '/data/magic.db']);
}
if ($cached = $cacheRead('mime_type_glob')) {
    Type::config('glob', ['adapter' => 'Memory']);
    foreach ($cached as $item) {
        Type::$glob->register($item);
    }
} else {
    Type::config('glob', ['adapter' => 'Freedesktop', 'file' => __DIR__ . '/data/glob.db']);
    $cacheWrite('mime_type_glob', Type::$glob->to('array'));
}
/*
 * Configure the adpters to be used by the media process class. Adjust this
 * mapping of media names to adapters according to your environment. For example:
 * most PHP installations have GD enabled thus should choose the `Gd` adapter for
 * image transformations. However the `Imagick` adapter may be more desirable
 * in other cases and also supports transformations for documents.
 */
use mm\Media\Process;
Process::config(['document' => $hasImagick ? 'Imagick' : null, 'image' => $hasImagick ? 'Imagick' : 'Gd']);
/*
 * Configure the adpters to be used by the media info class. Adjust this
 * mapping of media names to adapters according to your environment. In contrast
 * to `Process` which operates only with one adapter per media type
 * `Info` can use multiple adapters per media type.
 */
use mm\Media\Info;
Info::config(['image' => $hasImagick ? ['ImageBasic', 'Imagick'] : ['ImageBasic']]);
Exemple #2
0
 public function testMediaFactorySourceFailStream()
 {
     $this->setExpectedException('InvalidArgumentException');
     Info::factory(['source' => fopen("{$this->_files}/image_jpg.jpg", 'r')]);
 }