Display dynamic image from database or remote source with p:graphicImage and StreamedContent

前端 未结 4 1709
我寻月下人不归
我寻月下人不归 2020-11-21 11:10

I\'m trying to display image bytes which is saved in database as a StreamedContent in the as follows:



        
4条回答
  •  名媛妹妹
    2020-11-21 11:56

    Try including a mime type. In your posted example, you have it as "". The blank image may be because it doesn't recognize the stream as a image file since you made that field an empty string. So add a mime type of image/png or image/jpg and see if that works:

    String mimeType = "image/jpg";
    StreamedContent file = new DefaultStreamedContent(bytes, mimeType, filename);  
    

提交回复
热议问题