title: Missing image instead of imagepng
body: <p>I have a problem.
  That code should generate text to a image and showing this on the page, but doesn't work. That showing the missing image icon. Code:</p>
  <pre><code>$stmt = $pdo-&gt;prepare(&quot;SELECT * FROM imiona&quot;);
  $stmt -&gt; execute();
  
  while($row = $stmt -&gt; fetch(PDO::FETCH_ASSOC)) {
      $id = $row['id'];
      $japan = $row['imie_japan'];
      $polish = $row['imie_polish'];
      
      echo &quot;&lt;b&gt;&quot;.$polish.&quot;&lt;/b&gt;&lt;br&gt;&quot;;
      echo $japan.&quot;&lt;br&gt;&quot;;
      
      header(&quot;Content-type: image/png&quot;);
      $fontsize = 40;
      $fonttype = 'ARIAL.TTF';
      $width  = imagefontwidth($fontsize) * strlen($japan);
      $height = imagefontheight($fontsize);
      $image = imagecreatetruecolor($width,$height);
      $white = imagecolorallocate ($image,255,255,255);
      $black = imagecolorallocate ($image,0,0,0);
      imagefill($image,0,0,$white);
      imagettftext($image,$fontsize,0,0,0,$black,$fonttype,$japan);
      imagepng ($image);
      imagedestroy($image);
      echo &quot;&lt;br&gt;&quot;; }
  </code></pre>