⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.imagefttext.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Write text to the image using fonts using FreeType 2</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.imageftbbox.html">imageftbbox</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imagegammacorrect.html">imagegammacorrect</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.imagefttext" class="refentry"> <div class="refnamediv">  <h1 class="refname">imagefttext</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5)</p><p class="refpurpose"><span class="refname">imagefttext</span> &mdash; <span class="dc-title">Write text to the image using fonts using FreeType 2</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">array</span> <span class="methodname"><b><b>imagefttext</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$image</tt></span>   , <span class="methodparam"><span class="type">float</span> <tt class="parameter">$size</tt></span>   , <span class="methodparam"><span class="type">float</span> <tt class="parameter">$angle</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$x</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$y</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$color</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$fontfile</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$text</tt></span>   [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$extrainfo</tt></span>  ] )</div> </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">size</tt></i></span>     <dd>      <p class="para">       The font size to use in points.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">angle</tt></i></span>     <dd>      <p class="para">        The angle in degrees, with 0 degrees being left-to-right reading text.       Higher values represent a counter-clockwise rotation. For example, a        value of 90 would result in bottom-to-top reading text.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">x</tt></i></span>     <dd>      <p class="para">       The coordinates given by <i><tt class="parameter">x</tt></i> and       <i><tt class="parameter">y</tt></i> will define the basepoint of the first       character (roughly the lower-left corner of the character). This       is different from the <a href="function.imagestring.html" class="function">imagestring()</a>, where       <i><tt class="parameter">x</tt></i> and <i><tt class="parameter">y</tt></i> define the       upper-left corner of the first character. For example, &quot;top left&quot;       is 0, 0.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">y</tt></i></span>     <dd>      <p class="para">       The y-ordinate. This sets the position of the fonts baseline, not the       very bottom of the character.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">color</tt></i></span>     <dd>      <p class="para">       The index of the desired color for the text, see        <a href="function.imagecolorexact.html" class="function">imagecolorexact()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">fontfile</tt></i></span>     <dd>      <p class="para">       The path to the TrueType font you wish to use.      </p>      <p class="para">       Depending on which version of the GD library PHP is using, <em class="emphasis">when       <i><tt class="parameter">fontfile</tt></i> does not begin with a leading       <i>/</i> then <i>.ttf</i> will be appended</em>       to the filename and the library will attempt to search for that       filename along a library-defined font path.      </p>      <p class="para">       When using versions of the GD library lower than 2.0.18, a <i>space</i> character,       rather than a semicolon, was used as the &#039;path separator&#039; for different font files.       Unintentional use of this feature will result in the warning message:       <i>Warning: Could not find/open font</i>. For these affected versions, the       only solution is moving the font to a path which does not contain spaces.      </p>      <p class="para">       In many cases where a font resides in the same directory as the script using it       the following trick will alleviate any include problems.       <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Set&nbsp;the&nbsp;enviroment&nbsp;variable&nbsp;for&nbsp;GD<br /></span><span style="color: #0000BB">putenv</span><span style="color: #007700">(</span><span style="color: #DD0000">'GDFONTPATH='&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'.'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Name&nbsp;the&nbsp;font&nbsp;to&nbsp;be&nbsp;used&nbsp;(note&nbsp;the&nbsp;lack&nbsp;of&nbsp;the&nbsp;.ttf&nbsp;extension)<br /></span><span style="color: #0000BB">$font&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'SomeFont'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>       </div>      </p>     </dd>    </dt>    <dt>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -