function.imagesettile.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 116 行
HTML
116 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Set the tile image for filling</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div 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 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"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>imagesettile</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$image</tt></span> , <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$tile</tt></span> )</div> <p class="para rdfs-comment"> <b>imagesettile()</b> sets the tile image to be used by all region filling functions (such as <a href="function.imagefill.html" class="function">imagefill()</a> and <a href="function.imagefilledpolygon.html" class="function">imagefilledpolygon()</a>) when filling with the special color <b><tt>IMG_COLOR_TILED</tt></b>. </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 <a href="function.imagecolortransparent.html" class="function">imagecolortransparent()</a>, a tile allows certain parts of the underlying area to shine through can be created. </p> <blockquote><p><b class="note">Note</b>: 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 <b><tt>IMG_COLOR_TILED</tt></b> color until you have set a new tile image! <br /> </p></blockquote> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt><span class="term"><i><tt class="parameter">image</tt></i></span><dd><p class="para">An image resource, returned by one of the image creation functions, such as <a href="function.imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a>.</p></dd></dt> <dt> <span class="term"><i><tt class="parameter">tile</tt></i></span> <dd> <p class="para"> The image resource to be used as a tile. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>imagesettile()</b> example</b></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="figures/image.imagesettile.png" /> </div> </div> </div> </p> </div></div><hr /><div 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 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?