title: php : display image resource
body: <p>I feel quite stupid but I can't understand how to display the output of the imagepng() function.</p>
  
  <p>What I currently do is (and it works fine) :</p>
  
  <p><code>&lt;img src=&lt;?php echo getImage($element); ?&gt; /&gt;</code></p>
  
  <pre><code>function getImage($element){
      return $bdd[$element]; // the result is a string with the path to the image
  }
  </code></pre>
  
  <p>But I would love to draw some circles on the image, so here is what I would like to do (and it does not work) :</p>
  
  <p><code>&lt;img src=&lt;?php echo getImage($element); ?&gt; /&gt;</code></p>
  
  <pre><code>function getImage($element){
      $image = imagecreatefrompng($bdd[$element]);
      $ellipseColor = imagecolorallocate($image, 0, 0, 255);
      imagefilledellipse($image, 100, 100, 10, 10, $ellipseColor);
      imagepng($image);
  
      return $image // why does that image resource not display ?
  }
  </code></pre>
  
  <p>But it does not display anything else than symbols.. I assume it returns a full image and not a path to the image.. so How should I display my image with the circle on it ?</p>
  
  <p>ps : I also tried to create a page getImage.php that would be called by <code>&lt;img src=&lt;?php echo 'getImage.php?element=' . $element; ?&gt; /&gt;</code> but with no success</p>