<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Set the tile image for filling</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imagesetthickness.html">imagesetthickness</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imagestring.html">imagestring</a></div> <div class="up"><a href="ref.image.html">GD and Image Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.imagesettile" class="refentry"> <div class="refnamediv"> <h1 class="refname">imagesettile</h1> <p class="verinfo">(PHP 4 >= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">imagesettile</span> — <span class="dc-title">Set the tile image for filling</span></p> </div> <div class="refsect1 description" id="refsect1-function.imagesettile-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>imagesettile</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span> , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$tile</code></span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>imagesettile()</strong></span> sets the tile image to be used by all region filling functions (such as <span class="function"><a href="function.imagefill.html" class="function">imagefill()</a></span> and <span class="function"><a href="function.imagefilledpolygon.html" class="function">imagefilledpolygon()</a></span>) when filling with the special color <strong><code>IMG_COLOR_TILED</code></strong>. </p> <p class="para"> A tile is an image used to fill an area with a repeated pattern. <em class="emphasis">Any</em> GD image can be used as a tile, and by setting the transparent color index of the tile image with <span class="function"><a href="function.imagecolortransparent.html" class="function">imagecolortransparent()</a></span>, a tile allows certain parts of the underlying area to shine through can be created. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> You need not take special action when you are finished with a tile, but if you destroy the tile image, you must not use the <strong><code>IMG_COLOR_TILED</code></strong> color until you have set a new tile image! </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-function.imagesettile-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter"> image</code></em></span><dd> <p class="para">An image resource, returned by one of the image creation functions, such as <span class="function"><a href="function.imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>.</p></dd> </dt> <dt> <span class="term"><em><code class="parameter">tile</code></em></span> <dd> <p class="para"> The image resource to be used as a tile. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.imagesettile-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.imagesettile-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3279"> <p><strong>Example #1 <span class="function"><strong>imagesettile()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Load an external image<br /></span><span style="color: #0000BB">$zend </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefromgif</span><span style="color: #007700">(</span><span style="color: #DD0000">'./zend.gif'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Create a 200x200 image<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">200</span><span style="color: #007700">, </span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Set the tile<br /></span><span style="color: #0000BB">imagesettile</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">$zend</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Make the image repeat<br /></span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">199</span><span style="color: #007700">, </span><span style="color: #0000BB">199</span><span style="color: #007700">, </span><span style="color: #0000BB">IMG_COLOR_TILED</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Output image to the browser<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type: image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$zend</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="mediaobject"> <div class="imageobject"> <img src="images/21009b70229598c6a80eef8b45bf282b-imagesettile.png" alt="Output of example : imagesettile()" width="200" height="200" /> </div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imagesetthickness.html">imagesetthickness</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imagestring.html">imagestring</a></div> <div class="up"><a href="ref.image.html">GD and Image Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>