GD Funkcje
PHP Manual

imagecreatefromwbmp

(PHP 4 >= 4.0.1, PHP 5)

imagecreatefromwbmpCreate a new image from file or URL

Opis

resource imagecreatefromwbmp ( string $filename )

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

Wskazówka

Jeśli włączona jest dyrektywa konfiguracyjna fopen wrappers, możliwe jest podanie jako nazwy pliku adresu URL. Zobacz opis funkcji fopen() aby dowiedzieć się jak przekazać nazwę pliku, oraz fopen wrappers aby uzyskać listę obsługiwanych protokołów.

Parametry

filename

Path to the WBMP image.

Zwracane wartości

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

Przykłady

Przykład #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 (2020);
        
$bgc imagecolorallocate($im255255255);
        
$tc  imagecolorallocate($im000);

        
imagefilledrectangle($im001010$bgc);

        
/* Output an error message */
        
imagestring($im155'Error loading ' $imgname$tc);
    }

    return 
$im;
}

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

$img LoadPNG('bogus.image');

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

Notatki

Informacja: Obsługa WBMP jest dostępna tylko jeśli PHP zostało skompilowane z GD-1.8 lub nowszym.

Ostrzeżenie

PHP w wersji starszej niż 4.3.0, pracujące pod kontrolą systemów Windows, nie obsługują dostępu do zdalnych plików w tej funkcji, nawet jeśli opcja allow_url_fopen jest włączona.


GD Funkcje
PHP Manual