mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
154 lines
5.1 KiB
HTML
154 lines
5.1 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>Scale an image using the given new width and height</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.imagescale" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">imagescale</h1>
|
|
<p class="verinfo">(PHP 5 >= 5.5.0, PHP 7)</p><p class="refpurpose"><span class="refname">imagescale</span> — <span class="dc-title">Scale an image using the given new width and height</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.imagescale-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>imagescale</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
|
|
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$new_width</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$new_height</code><span class="initializer"> = -1</span></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = IMG_BILINEAR_FIXED</span></span>
|
|
]] ) : <span class="type">resource</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
<span class="function"><strong>imagescale()</strong></span> scales an image using the given
|
|
interpolation algorithm.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
Unlike many of other image functions, <span class="function"><strong>imagescale()</strong></span> does
|
|
not modify the passed <code class="parameter">image</code>; instead, a
|
|
<em class="emphasis">new</em> image is returned.
|
|
</p>
|
|
</p></blockquote>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.imagescale-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<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">new_width</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The width to scale the image to.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">new_height</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The height to scale the image to. If omitted or negative, the aspect
|
|
ratio will be preserved.
|
|
</p>
|
|
<div class="caution"><strong class="caution">Caution</strong>
|
|
<p class="para">
|
|
You should always provide the height if using PHP 5.5.18 or earlier, or
|
|
PHP 5.6.2 or earlier, as the aspect ratio calculation was incorrect.
|
|
</p>
|
|
</div>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">mode</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
One of <strong><code>IMG_NEAREST_NEIGHBOUR</code></strong>,
|
|
<strong><code>IMG_BILINEAR_FIXED</code></strong>,
|
|
<strong><code>IMG_BICUBIC</code></strong>,
|
|
<strong><code>IMG_BICUBIC_FIXED</code></strong> or anything else (will use two
|
|
pass).
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<span class="simpara">
|
|
<strong><code>IMG_WEIGHTED4</code></strong> is not yet supported.
|
|
</span>
|
|
</p></blockquote>
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.imagescale-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Return the scaled image resource on success 或者在失败时返回 <strong><code>FALSE</code></strong>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.imagescale-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.5.19/5.6.3</td>
|
|
<td>
|
|
The calculation of the height if <code class="parameter">new_height</code> was
|
|
negative or omitted was fixed; prior to these versions, the aspect
|
|
ratio was not maintained correctly.
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.imagescale-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<span class="function"><a href="imagecopyresized.html" class="function" rel="rdfs-seeAlso">imagecopyresized()</a> - 拷贝部分图像并调整大小</span>
|
|
<span class="function"><a href="imagecopyresampled.html" class="function" rel="rdfs-seeAlso">imagecopyresampled()</a> - 重采样拷贝部分图像并调整大小</span>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |