title: PHP display png image from binary file
body: <p>I have binary file where is stored image, i try get this image, but display only black color image, what can be wrong with my code or binary file.</p>
  
  <pre><code>&lt;?php
  function LoadPNG ($imgname) {
      $im = @imagecreatefrompng ($imgname); 
  
      if (!$im) { 
          $im= imagecreate (150, 30); 
          $bgc = imagecolorallocate ($im, 255, 255, 255);
          $tc= imagecolorallocate ($im, 0, 0, 0);
          imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
  
          imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
      }
      return $im;
  }
  
  header('Content-Type: image/png');
  
  $img = LoadPNG('452');
  
  imagepng($img);
  imagedestroy($img);
  ?&gt;
  </code></pre>
  
  <p>with this code I get I error that can't load file</p>
  
  <p>File: <a href="http://testams.serveriai.lt.lazdynas.serveriai.lt/452" rel="nofollow">testams.serveriai.lt.lazdynas.serveriai.lt/452</a>
  Script:  <a href="http://testams.serveriai.lt.lazdynas.serveriai.lt/crypt.php" rel="nofollow">testams.serveriai.lt.lazdynas.serveriai.lt/crypt.php</a></p>