imagecreatefromwbmp — Create a New Image from a File or URL

imagecreatefromwbmp is a PHP function that loads a WBMP image from a given filename or URL, returning an image resource on success or FALSE on failure, with details on its parameter, return values, and a complete example demonstrating error handling and image output.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
imagecreatefromwbmp — Create a New Image from a File or URL

The imagecreatefromwbmp function in PHP creates an image resource from a WBMP file or URL. It takes a single string argument $filename representing the path to the WBMP image.

On success it returns an image resource; on failure it returns FALSE.

Parameters

filename : The path to the WBMP image file.

Return value : Image resource on success, FALSE on error.

Example

<?php
function LoadWBMP($imgname)
{
    /* Attempt to open */
    $im = @imagecreatefromwbmp($imgname);
    /* See if it failed */
    if (!$im)
    {
        /* Create a blank image */
        $im = imagecreatetruecolor(150,30);
        $bgc = imagecolorallocate($im,255,255,255);
        $tc = imagecolorallocate($im,0,0,0);
        imagefilledrectangle($im,0,0,150,30,$bgc);
        /* Output an error message */
        imagestring($im,1,5,5,'Error loading '.$imgname,$tc);
    }
    return $im;
}
header('Content-Type: image/vnd.wap.wbmp');
$img = LoadWBMP('bogus.image');
imagewbmp($img);
imagedestroy($img);
?>
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendGraphicsImagewbmp
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.