GD and Image Функции
PHP Manual

imagecreatefromwbmp

(PHP 4 >= 4.0.1, PHP 5)

imagecreatefromwbmp — Create a new image from file or URL

Описание

resource imagecreatefromwbmp ( string $filename )

imagecreatefromwbmp() returns an image identifier representing the image obtained from the given filename.

Подсказка

Для этой функции вы можете использовать URL в качестве имени файла, если была включена опция "fopen wrappers". Смотрите более подробную информацию об определении имени файла в описании функции fopen(), а также список поддерживаемых протоколов URL в List of Supported Protocols/Wrappers.

Список параметров

filename

Path to the WBMP image.

Возвращаемые значения

Returns an image resource identifier on success, FALSE on errors.

Примеры

Пример #1 Example to handle an error during loading of a WBMP

<?php
function LoadWBMP($imgname)
{
    
/* Attempt to open */
    
$im = @imagecreatefromwbmp($imgname);

    
/* See if it failed */
    
if(!$im)
    {
        
/* Create a blank image */
        
$im  = imagecreatetruecolor (20, 20);
        
$bgc = imagecolorallocate($im, 255, 255, 255);
        
$tc  = imagecolorallocate($im, 0, 0, 0);

        
imagefilledrectangle($im, 0, 0, 10, 10, $bgc);

        
/* Output an error message */
        
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
    }

    return 
$im;
}

header('Content-Type: image/png');

$img = LoadPNG('bogus.image');

imagwbmp($img);
imagedestroy($img);
?>

Примечания

Замечание: WBMP support is only available if PHP was compiled against GD-1.8 or later.

Внимание

Версии PHP для Windows до PHP 4.3.0 не поддерживают возможность использования удаленных файлов этой функцией даже в том случае, если опция allow_url_fopen включена.


GD and Image Функции
PHP Manual