imagecreatefromwbmp 


gd apg

CREATE a new image from file or URL from a WBMP, (Wireless Bitmap), image.





This function returns an image identifier representing the image obtained from the given filename.





This function returns FALSE on errors.

The GdImage, resource or object returned by this function allows the creation of other image formats from WBMP format.



<?php

GdImage
|false imagecreatefromwbmpstring $filename )


where,

$filename The path to an existing WBMP image 

?>
 

  $filename   


The path or stream resource.

$filename can reference a local file or, (configuration permitting), a remote file using one of the supported stream wrappers:

STREAM WRAPPERS MEANING
file:// LOCAL File System
http:// URL HTTP
ftp:// URL FTP
php:// I/O streams
zlib:// Data Compression stream
data:// DATA (RFC-2397)
glob:// Find Filenames
phar:// PHP Archive
ssh2:// Secure Shell 2
rar:// RAR
ogg:// Audio
expect:// Interaction of stream processes
ed48


  1 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>'

$img_file "wbmp/WBMP 001 01.wbmp"

$img_name "png/PNG 021 01 (wbmp2png).png"

echo 
$img_file?><br><br>Existing Image...<br>
However, it cannot be displayed by this browser.

<?php

$im01 
imagecreatefromwbmp($img_file); 

// var_dump($im01);

echo '<br><br>'

$bool01 imagepng($im01$img_name);   

if (
$bool01 == true)   
{   
echo 
'The new format has been created!<br><br>' 
$img_name '<br><br>';  

echo 
'<img src="' $img_name 
'" alt="' $img_name '" title="' $img_name '">';  
}   
else   
{   
echo 
'$bool01 = ' $bool01 
'<br><br>The image was NOT created!';   
}   

?> 

 RESULT   

WBMP 001 01.wbmp

Existing Image...
however, it cannot be displayed by this browser.



The .png format of the image has been created!

PNG 021 01 (wbmp2png).png

PNG 021 01 (wbmp2png).png apr

  2 EXERCISE   

<?php 

$img_file 
"wbmp/WBMP 006 03 P de Galinhas (webp2wbmp).wbmp"

$img_name "png/PNG 022 02 P de Galinhas (wbmp2png).png"

echo 
$img_file?><br><br>Existing Image...<br>
however, it cannot be displayed by this browser.

<?php

$im02 
imagecreatefromwbmp($img_file); 

// var_dump($im02);

echo '<br><br>'

$bool02 imagepng($im02$img_name);

if (
$bool02 == true)   
{   
echo 
'The new format of the image has been created!<br><br>' 
$img_name '<br><br>';  

echo 
'<img src="' $img_name 
'" alt="' $img_name '" title="' $img_name '" width="400">';  
}   
else   
{   
echo 
'$bool02 = ' $bool02 
 
'<br><br>The image was NOT created!';   
}   

?> 

 RESULT   

WBMP 006 03 P de Galinhas (webp2wbmp).wbmp

Existing image...
however, it cannot be displayed by this browser.



The .png format of the image has been created!

PNG 022 02 P de Galinhas (wbmp2png).png

PNG 022 02 P de Galinhas (wbmp2png).png apr

This function requires the original image to be black and white, otherwise it will be displayed incorrectly, as shown above.

  3 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>'

$img_file "wbmp/WBMP 007 03 P de Galinhas.wbmp"

$img_name "bmp/BMP 007 03 P de Galinhas (wbmp2bmp).bmp"

echo 
$img_file?><br><br>Existing Image...<br>
however, it cannot be displayed by this browser.

<?php

$im03 
imagecreatefromwbmp($img_file); 

// var_dump($im03);

echo '<br><br>'

$bool03 imagebmp($im03$img_name);

if (
$bool03 == true)   
{   
echo 
'The new format of the image has been created!<br><br>' 
$img_name '<br><br>';  

echo 
'<img src="' $img_name 
'" alt="' $img_name '" title="' $img_name '" width="400">';  
}   
else   
{   
echo 
'$bool03 = ' $bool03 
 
'<br><br>The image was NOT created!';   
}   

?> 

 RESULT   

WBMP 007 03 P de Galinhas.wbmp

Existing image...
however, it cannot be displayed by this browser.



The .bmp format of the image has been created!

BMP 007 03 P de Galinhas (wbmp2bmp).bmp

BMP 007 03 P de Galinhas (wbmp2bmp).bmp apr

This image has only two colors, (white and black), so this function displays a correct result as shown.