Creating an image instance using imagecreatefromxpm() to load xpm file in PHP

Description

The following code shows how to creating an image instance using imagecreatefromxpm() to load xpm file.

Example


<?php// ww  w  . ja  v  a2s .c o  m
// Check for XPM support
if(!(imagetypes() & IMG_XPM))
{
    die('Support for xpm was not found!');
}

// Create the image instance
$xpm = imagecreatefromxpm('./example.xpm');

// Do image operations here

// PHP has no support for writing xpm images
// so in this case we save the image as a
// jpeg file with 100% quality
imagejpeg($xpm, './example.jpg', 100);
imagedestroy($xpm);
?>




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text