title: Display dynamic image from database or remote source with p:graphicImage and StreamedContent
body: <p>I'm trying to display image bytes which is saved in database as a <code>StreamedContent</code> in the <code>&lt;p:graphicImage&gt;</code> as follows:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;p:graphicImage  value="#{item.imageF}" width="50"  id="grpImage" height="80"/&gt;
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>private StreamedContent content; // getter and setter
  
  public StreamedContent getImageF() {
  
      if (student.getImage() != null) {
          InputStream is = new ByteArrayInputStream(student.getImage());
          System.out.println("Byte :"+student.getImage());
          content = new DefaultStreamedContent(is, "", student.getStuID());
          System.out.println("ddd ------------------------------- " + content);
          return content;
      }
  
      return content;
  }
  </code></pre>
  
  <p>This returns a blank image. How is this caused and how can I solve it?</p>
  
  <p>The stdout prints the following:</p>
  
  <pre><code>INFO: Byte :[B@a2fb48
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@b0887b
  INFO: Byte :[B@a2fb48
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@1d06a92
  INFO: Byte :[B@d52f0b
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@39a60
  INFO: Byte :[B@d52f0b
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@8c3daa
  INFO: Byte :[B@124728a
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@1dbe05b
  INFO: Byte :[B@124728a
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@66a266
  INFO: Byte :[B@a2fb48
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@1293976
  INFO: Byte :[B@a2fb48
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@17b7399
  INFO: Byte :[B@d52f0b
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@1e245a5
  INFO: Byte :[B@d52f0b
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@4a7153
  INFO: Byte :[B@124728a
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@1561bfd
  INFO: Byte :[B@124728a
  INFO: ddd ------------------------------- org.primefaces.model.DefaultStreamedContent@47a8c2
  </code></pre>