<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.imagepng.php',
    1 => 'imagepng',
    2 => 'Ausgabe eines Bildes im Browser oder als Datei im PNG-Format',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'GD- und Image-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.imagepalettetotruecolor.php',
    1 => 'imagepalettetotruecolor',
  ),
  'next' => 
  array (
    0 => 'function.imagepolygon.php',
    1 => 'imagepolygon',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/image/functions/imagepng.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imagepng" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagepng</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imagepng</span> &mdash; <span class="dc-title">Ausgabe eines Bildes im Browser oder als Datei im PNG-Format</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagepng-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagepng</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="class.gdimage.php" class="type GdImage">GdImage</a></span> <code class="parameter">$image</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$file</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$quality</code><span class="initializer"> = -1</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$filters</code><span class="initializer"> = -1</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Erzeugt eine <abbr title="Portable Network Graphics">PNG</abbr>-Datei aus dem übergebenen
   <code class="parameter">image</code> oder gibt diese direkt aus.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagepng-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">image</code></dt><dd><p class="para">Ein <span class="classname"><a href="class.gdimage.php" class="classname">GdImage</a></span>-Objekt, das von einer der Funktionen zur Bilderzeugung, z. B.
<span class="function"><a href="function.imagecreatetruecolor.php" class="function">imagecreatetruecolor()</a></span>, zurückgegeben wurde.</p></dd>
    
     <dt><code class="parameter">file</code></dt>
     <dd>
      <p class="para">Der Pfad oder eine offene Stream-Ressource (die nach der Beendigung dieser Funktion automatisch geschlossen wird), in dem bzw. der die Datei gespeichert werden soll. Falls nicht gesetzt oder <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, wird der rohe Bilddatenstrom direkt ausgegeben.</p>
      <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
       <p class="para">
        <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> ist ungültig, wenn die Parameter
        <code class="parameter">quality</code> und
        <code class="parameter">filters</code> nicht übergeben werden.
       </p>
      </p></blockquote>
     </dd>
    
    
     <dt><code class="parameter">quality</code></dt>
     <dd>
      <p class="para">
       Kompressionsstufe: Von 0 (keine Kompression) bis 9.
       Die Voreinstellung (<code class="literal">-1</code>) verwendet die voreingestellte
       zlib-Komprimierung. Weitere Informationen sind dem
       <a href="http://www.zlib.net/manual.html" class="link external">&raquo;&nbsp;zlib Handbuch</a>
       zu entnehmen.
      </p>
     </dd>
    
    
     <dt><code class="parameter">filters</code></dt>
     <dd>
      <p class="para">
       Erlaubt einer Verkleinerung der PNG-Dateigröße. Dies ist
       ein Bitfeld, welches beliebig aus den
       <strong><code><a href="image.constants.php#constant.png-filter-none">PNG_FILTER_<span class="replaceable">*</span></a></code></strong>-Konstanten
       zusammengesetzt werden kann. <strong><code><a href="image.constants.php#constant.png-no-filter">PNG_NO_FILTER</a></code></strong> oder
       <strong><code><a href="image.constants.php#constant.png-all-filters">PNG_ALL_FILTERS</a></code></strong> können verwendet werden,
       um entweder alle Filter aus- oder einzuschalten.
       Der Vorgabewert (<code class="literal">-1</code>) deaktiviert die Filterung.
      </p>
      <div class="caution"><strong class="caution">Achtung</strong>
       <p class="simpara">
        Der Parameter <code class="parameter">filters</code> wird von der System-libgd
        ignoriert.
       </p>
      </div>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagepng-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
  <div class="caution"><strong class="caution">Achtung</strong><p class="simpara">Wenn libgd das Bild nicht ausgeben kann, gibt diese Funktion <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück.</p></div>
 </div>


 <div class="refsect1 errors" id="refsect1-function.imagepng-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="simpara">
   Wenn <code class="parameter">quality</code> ungültig ist, wird ein
   <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> geworfen.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imagepng-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       Wirft nun einen <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span>, wenn
       <code class="parameter">quality</code> ungültig ist.
      </td>
     </tr>

     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">image</code> erwartet nun eine
  <span class="classname"><a href="class.gdimage.php" class="classname">GdImage</a></span>-Instanz; vorher wurde eine gültige
  <code class="literal">gd</code>-<span class="type">Ressource</span> erwartet.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.imagepng-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.png"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type: image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imagepng-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagegif.php" class="function" rel="rdfs-seeAlso">imagegif()</a> - Gibt das Bild im Browser oder einer Datei aus.</span></li>
   <li><span class="function"><a href="function.imagewbmp.php" class="function" rel="rdfs-seeAlso">imagewbmp()</a> - Gibt das Bild im Browser oder einer Datei aus.</span></li>
   <li><span class="function"><a href="function.imagejpeg.php" class="function" rel="rdfs-seeAlso">imagejpeg()</a> - Gibt das Bild im Browser oder einer Datei aus.</span></li>
   <li><span class="function"><a href="function.imagetypes.php" class="function" rel="rdfs-seeAlso">imagetypes()</a> - Liefert die von der verwendeten PHP-Version unterst&uuml;tzten Grafikformate</span></li>
   <li><span class="function"><a href="function.imagesavealpha.php" class="function" rel="rdfs-seeAlso">imagesavealpha()</a> - Ob beim Speichern von Bildern vollst&auml;ndige Alphakanal-Information erhalten wird</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>