mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
122 lines
3.1 KiB
XML
122 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.imagecrop" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>imagecrop</refname>
|
|
<refpurpose>Crop an image to the given rectangle</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>GdImage</type><type>false</type></type><methodname>imagecrop</methodname>
|
|
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>rectangle</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Crops an image to the given rectangular area and returns the resulting image.
|
|
The given <parameter>image</parameter> is not modified.
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
&gd.image.description;
|
|
<varlistentry>
|
|
<term><parameter>rectangle</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The cropping rectangle as <type>array</type> with keys
|
|
<literal>x</literal>, <literal>y</literal>, <literal>width</literal> and
|
|
<literal>height</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Return cropped image object on success&return.falseforfailure;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&gd.changelog.image-param;
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
On success, this function returns a <classname>GDImage</classname> instance now;
|
|
previously, a <type>resource</type> was returned.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="imagecrop.example.basic">
|
|
<title><function>imagecrop</function> example</title>
|
|
<para>
|
|
This example shows how to crop an image to a square area.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$im = imagecreatefrompng('example.png');
|
|
$size = min(imagesx($im), imagesy($im));
|
|
$im2 = imagecrop($im, ['x' => 0, 'y' => 0, 'width' => $size, 'height' => $size]);
|
|
if ($im2 !== FALSE) {
|
|
imagepng($im2, 'example-cropped.png');
|
|
imagedestroy($im2);
|
|
}
|
|
imagedestroy($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>imagecropauto</function></member>
|
|
</simplelist>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|