mtassinari Posted January 7, 2010 Share Posted January 7, 2010 Hi everybody!As the topic title suggests, I'd like to know if there is a way to print an image into a report if that image is stored into a BLOB field on a database. Is this possible? If so, how?thanks in advance for your help. Link to comment Share on other sites More sharing options...
lucianc Posted January 12, 2010 Share Posted January 12, 2010 You can declare the field as java.awt.Image and use it in the image expression.HTH,Lucian Link to comment Share on other sites More sharing options...
mtassinari Posted January 12, 2010 Author Share Posted January 12, 2010 Ok, I'll try it, thank you! Link to comment Share on other sites More sharing options...
mtassinari Posted February 2, 2010 Author Share Posted February 2, 2010 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now