php-doc-en/reference/image/functions/imagepng.xml
Máté Kocsis 593ea510e8
Generate ext/gd methodsynopses based on stubs
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-623.
2021-05-24 13:14:32 +02:00

144 lines
4.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.imagepng" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>imagepng</refname>
<refpurpose>Output a PNG image to either the browser or a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>imagepng</methodname>
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>resource</type><type>string</type><type>null</type></type><parameter>file</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>quality</parameter><initializer>-1</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>filters</parameter><initializer>-1</initializer></methodparam>
</methodsynopsis>
<para>
Outputs or saves a <acronym>PNG</acronym> image from the given
<parameter>image</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&gd.image.description;
<varlistentry>
<term><parameter>file</parameter></term>
<listitem>
<para>&gd.image.path;</para>
<note>
<para>
&null; is invalid if the <parameter>quality</parameter> and
<parameter>filters</parameter> arguments are not used.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>quality</parameter></term>
<listitem>
<para>
Compression level: from 0 (no compression) to 9.
The default (<literal>-1</literal>) uses the zlib compression default.
For more information see the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&url.zlib.manual;">zlib manual</link>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>filters</parameter></term>
<listitem>
<para>
Allows reducing the PNG file size. It is a bitmask field which may be
set to any combination of the <literal>PNG_FILTER_XXX</literal>
constants. <constant>PNG_NO_FILTER</constant> or
<constant>PNG_ALL_FILTERS</constant> may also be used to respectively
disable or activate all filters.
The default value (<literal>-1</literal>) disables filtering.
</para>
<caution>
<simpara>
The <parameter>filters</parameter> parameter is ignored by system libgd.
</simpara>
</caution>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
&gd.return.trueonerror;
</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;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$im = imagecreatefrompng("test.png");
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
]]>
</programlisting>
</informalexample>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>imagegif</function></member>
<member><function>imagewbmp</function></member>
<member><function>imagejpeg</function></member>
<member><function>imagetypes</function></member>
<member><function>imagesavealpha</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
-->