Jump to content

print image from BLOB database field


mtassinari

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 3 weeks later...

After quite a long time, I've tried doing as you suggested.

Now, the database table contains a field named "image_content" which is a mediumblob which stores the image. The image itself was loaded in the filed via PHP, by reading the image file and saving a base64 encoding of it, so that when the image is retrieved, a base64 decode shows the image correctly.

The problem is, if I set the image in the report to java.awt.Image type, I get this error when trying to print:

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{image_content}

Can somebody help me with this?



EDIT: Solved! iReport recognized the database field as an Object, I just had to manually correct it to java.awt.Image. Perhaps it'd be useful to add "java.awt.Image" to the list of default types for a database field.




Post Edited by mtassinari at 02/02/2010 12:02
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...