Tuesday, November 19, 2024
Google search engine
HomeLanguagesPHP | imagecreatefromwbmp() Function

PHP | imagecreatefromwbmp() Function

The imagecreatefromwbmp() function is an inbuilt function in PHP which is used to create a new image from WBMP file or URL. WBMP (Wireless Application Protocol Bitmap Format) is a monochrome graphics file format optimized for mobile computing devices. This loaded image can be further worked upon in the program. This function is usually used when you want to edit your images after loading them from a WBMP file. An image can be converted into WBMP using imagewbmp() function.

Syntax:

resource imagecreatefromwbmp( string $filename )

Parameters: This function accepts a single parameter $filename which holds the name of image.

Return Value: This function returns an image resource identifier on success, FALSE on errors.

Below examples illustrate the imagecreatefromwbmp() function in PHP:

Example 1:




<?php
  
// Load an WBMP image from local folder
// You can convert any image to WBMP using
// imagewbmp() function or online convertors
$im = imagecreatefromwbmp('./neveropen.wbmp');
  
// View the loaded image in browser
imagewbmp($im);
imagedestroy($im);
?>


Output:

This will load the content into browser in the form 
of unsupported text as browsers don't support WBMP.

Example 2:




<?php
  
// Load an WBMP image from local folder
// You can convert any image to WBMP using
// imagewbmp() function or online convertors
$im = imagecreatefromwbmp('./neveropen.wbmp');
  
// Output the image by converting it into PNG
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>


Output:

Reference: https://www.php.net/manual/en/function.imagecreatefromwbmp.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments