title: Symfony2 send image created with imagecreate() via response(httpfoundation)
body: <p>I want to send simple image through httpgoundation response, from one controller to another. Here's my code:</p>
  
  <pre><code>    $string = (string)md5(uniqid());
      $string = substr($string, 0, $length);
  
      $image = imagecreate(200, 50);
      imagefill($image, 0, 0, "#000000");
  
      $headers= array(
          'Content-type'=&gt;'image/jpeg',
          'Pragma'=&gt;'no-cache',
          'Cache-Control'=&gt;'no-cache'
      );
  
      $response = new Response( $image, 200, $headers );
  
      return new Response($response);
  </code></pre>
  
  <p>The error says <code>The Response content must be a string or object implementing __toString()</code>. Seeking the answer using google I only found people who want to return file somewhere from server(an asset). What should I do to get this working?</p>