-1

How to add dynamic image in jasper report using jasper studio.Database is postgresql

image is stored in bytea format

how to display that image in jasper report.

How to solve this?? is there any other method?

data base query ->

select encode(image,'escape') as img,id from entity_image where entity_id = 100

image expression-> new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes()))

Alex K
  • 22,315
  • 19
  • 108
  • 236
tst
  • 1
  • 1
  • 2
  • 1
    Could you share what you have tried so far ? – User123456 Oct 22 '18 at 06:10
  • data base query -> select encode(image,'escape') as img,id from entity_image where entity_id = 100 image expression-> new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes())) – tst Oct 22 '18 at 06:29
  • Could you add this in question ? – User123456 Oct 22 '18 at 06:29
  • You don't need to encode/decode the bytea data. Just do select image as img ..., set the field type to java.awt.Image and use $F{image} as image expression. – dada67 Oct 22 '18 at 08:46

1 Answers1

0

You don't need to encode/decode the bytea data.

Just directly select the bytea column as in select image, id ..., set the field type to java.awt.Image and use $F{image} as image expression.

dada67
  • 4,723
  • 17
  • 19