<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.imagecreatefromxpm.php',
    1 => 'imagecreatefromxpm',
    2 => 'Create a new image from file or URL',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'GD and Image Functions',
  ),
  'prev' => 
  array (
    0 => 'function.imagecreatefromxbm.php',
    1 => 'imagecreatefromxbm',
  ),
  'next' => 
  array (
    0 => 'function.imagecreatetruecolor.php',
    1 => 'imagecreatetruecolor',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/image/functions/imagecreatefromxpm.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imagecreatefromxpm" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagecreatefromxpm</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.1, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imagecreatefromxpm</span> &mdash; <span class="dc-title">Create a new image from file or URL</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagecreatefromxpm-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagecreatefromxpm</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><span class="type"><a href="class.gdimage.php" class="type GdImage">GdImage</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imagecreatefromxpm()</strong></span> returns an image identifier
   representing the image obtained from the given filename.
  </p>
  <div class="tip"><strong class="tip">Tip</strong><p class="simpara">A URL can be used as a
filename with this function if the <a href="filesystem.configuration.php#ini.allow-url-fopen" class="link">fopen wrappers</a> have been enabled.
See <span class="function"><a href="function.fopen.php" class="function">fopen()</a></span> for more details on how to specify the
filename. See the <a href="wrappers.php" class="xref">Supported Protocols and Wrappers</a> for links to information
about what abilities the various wrappers have, notes on their usage,
and information on any predefined variables they may
provide.</p></div>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagecreatefromxpm-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       Path to the XPM image.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagecreatefromxpm-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">Returns an image object on success, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on errors.</p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imagecreatefromxpm-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       On success, this function returns a <span class="classname"><a href="class.gdimage.php" class="classname">GDImage</a></span> instance now;
       previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was returned.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.imagecreatefromxpm-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Creating an image instance using <span class="function"><strong>imagecreatefromxpm()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Check for XPM support<br /></span><span style="color: #007700">if(!(</span><span style="color: #0000BB">imagetypes</span><span style="color: #007700">() &amp; </span><span style="color: #0000BB">IMG_XPM</span><span style="color: #007700">))<br />{<br />    die(</span><span style="color: #DD0000">'Support for xpm was not found!'</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">// Create the image instance<br /></span><span style="color: #0000BB">$xpm </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefromxpm</span><span style="color: #007700">(</span><span style="color: #DD0000">'./example.xpm'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Do image operations here<br /><br />// PHP has no support for writing xpm images<br />// so in this case we save the image as a <br />// jpeg file with 100% quality<br /></span><span style="color: #0000BB">imagejpeg</span><span style="color: #007700">(</span><span style="color: #0000BB">$xpm</span><span style="color: #007700">, </span><span style="color: #DD0000">'./example.jpg'</span><span style="color: #007700">, </span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


</div><?php manual_footer($setup); ?>