mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
156 lines
6.5 KiB
HTML
156 lines
6.5 KiB
HTML
<!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>用给定角度旋转图像</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.imagerotate" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">imagerotate</h1>
|
|
<p class="verinfo">(PHP 4 >= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imagerotate</span> — <span class="dc-title">用给定角度旋转图像</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.imagerotate-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>imagerotate</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
|
|
, <span class="methodparam"><span class="type">float</span> <code class="parameter">$angle</code></span>
|
|
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$bgd_color</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$ignore_transparent</code><span class="initializer"> = 0</span></span>
|
|
] ) : <span class="type">resource</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
将 <code class="parameter">src_im</code> 图像用给定的
|
|
<code class="parameter">angle</code> 角度旋转。<code class="parameter">bgd_color</code>
|
|
指定了旋转后没有覆盖到的部分的颜色。
|
|
</p>
|
|
<p class="para">
|
|
旋转的中心是图像的中心,旋转后的图像会按比例缩小以适合目标图像的大小——边缘不会被剪去。
|
|
</p>
|
|
<p class="para">
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.imagerotate-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
<dt>
|
|
<code class="parameter">image</code></dt>
|
|
|
|
<dd>
|
|
<p class="para">由图象创建函数(例如<span class="function"><a href="imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>)返回的图象资源。</p></dd>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">angle</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Rotation angle, in degrees. The rotation angle is interpreted as the
|
|
number of degrees to rotate the image anticlockwise.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">bgd_color</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Specifies the color of the uncovered zone after the rotation
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">ignore_transparent</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
如果被设为非零值,则透明色会被忽略(否则会被保留)。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.imagerotate-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
返回旋转后的图像资源,
|
|
或者在失败时返回 <strong><code>FALSE</code></strong>。
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.imagerotate-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<p class="para">
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>5.1.0</td>
|
|
<td>
|
|
新增: <code class="parameter">ignore_transparent</code> 。
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.imagerotate-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-3734">
|
|
<p><strong>Example #1 将图像旋转 180 度</strong></p>
|
|
<div class="example-contents"><p>
|
|
本例将把一幅图像旋转 180 度——上下颠倒。
|
|
</p></div>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// File and rotation<br /></span><span style="color: #0000BB">$filename </span><span style="color: #007700">= </span><span style="color: #DD0000">'test.jpg'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$degrees </span><span style="color: #007700">= </span><span style="color: #0000BB">180</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Content type<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type: image/jpeg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Load<br /></span><span style="color: #0000BB">$source </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefromjpeg</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Rotate<br /></span><span style="color: #0000BB">$rotate </span><span style="color: #007700">= </span><span style="color: #0000BB">imagerotate</span><span style="color: #007700">(</span><span style="color: #0000BB">$source</span><span style="color: #007700">, </span><span style="color: #0000BB">$degrees</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Output<br /></span><span style="color: #0000BB">imagejpeg</span><span style="color: #007700">(</span><span style="color: #0000BB">$rotate</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程的输出类似于:</p></div>
|
|
<div class="mediaobject">
|
|
|
|
<div class="imageobject">
|
|
<img src="images/21009b70229598c6a80eef8b45bf282b-imagerotate.jpg" alt="例子的输出:将图像旋转 180 度" width="95" height="51" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 notes" id="refsect1-function.imagerotate-notes">
|
|
<h3 class="title">注释</h3>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">此函数仅在与 GD 库捆绑编译的 PHP 版本中可用。</span></p></blockquote>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |