Dynamic content rendering / streaming #3364
-
Hello! I'm trying to make a gallery of uploaded images. I got it to work, but I don't think it works the way it should. The problem is that within the <p:graphicImage> tag I pass as parameter the id of the loaded image and I try to recover it in the method that returns the image stream, but the method is executed several times, the first times the id parameter arrives as null and at last it has the correct value. I solved it by returning the last image of the list when the parameter arrives null and returning the image that has that id, otherwise. View: `<p:fileUpload mode="simple" <p:galleria id="galleria" value="#{cropUploaderBean.photos}" var="photo" <p:graphicImage cache="false" value="#{cropUploaderBean.originalImageStream}" style="height: 100%; width: 100%; object-fit: contain"> <f:param name="photoId" value="#{photo.id}"/> </p:graphicImage>
Controller: `public StreamedContent getOriginalImageStream() {
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In general it might get invoked multiple times, ready carefully here: https://primefaces.github.io/primefaces/15_0_0/#/core/dynamiccontentstreaming?id=during-rendering Even our example is broken a bit here: http://www.primefaces.org/showcase/ui/multimedia/galleria/dynamic.xhtml
|
Beta Was this translation helpful? Give feedback.
Also see primefaces/primefaces#13193