imagecreatefromany

GD, PHP

Jump to: navigation, search

Читаем изображение, формат которого неизвестен.

function imagecreatefromany($filename) {
    foreach (array('png', 'jpeg', 'gif', 'bmp', 'ico') as $type) {
        $func = 'imagecreatefrom' . $type;
        if (is_callable($func)) {
            $image = @call_user_func($func, $filename);
            if ($image) return $image;
        }
    }
    return false;
}

Personal tools
ссылка