0

I am trying to build a web app in which, after a user uploads a file, and selection a filter he would click on a button and a preview of that image(filtered) would be displayed on the browser. I am using primefaces and my main problem is the display of the graphic image.

I set the graphic image like this:

<h:graphicImage rendered="#{bean.sth ne null}" value="#{bean.imgPreview}">

in order not to have a null pointer exception on page first load.

My main problem is that when I upload the file, I would like to update this graphic image in order to get the new image value.

What I have tried:

  • cache = false
  • wrap it inside panel and update the panel and dialog

Could you please help me.

raistlin
  • 231
  • 2
  • 11
  • Is this actual code? The rendered attribute is missing quotes and the value attribute is a literal text which looks like an EL expression... – Diego Jan 27 '15 at 23:59
  • 1
    Since you are using PrimeFaces, I assumed `bean.imgPreview` is a type of `org.primefaces.model.StreamedContent`. The cover story is available over [here](http://stackoverflow.com/a/12452144/1391249). Deliberately pay special attention : "*Images are not "inlined" in HTML output, but they are instead requested separately*". (Off side : Insist upon using `` while using PrimeFaces). – Tiny Jan 28 '15 at 00:32
  • [This post](http://stackoverflow.com/questions/2288399/create-and-show-thumbnail-byte-in-jsf) may also help if you want to stick to `h:graphicImage` – Diego Jan 28 '15 at 00:34

0 Answers0