php-doc-en/reference/image/functions/imagecrop.xml
Christoph Michael Becker 6e2531fee2 Fix XML ID
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344334 c90b9560-bf6c-de11-be94-00142212c4b1
2018-02-23 09:53:34 +00:00

100 lines
2.6 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>resource</type><methodname>imagecrop</methodname>
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
<methodparam><type>array</type><parameter>rect</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>rect</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 resource on success&return.falseforfailure;.
</para>
</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
-->