Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Chart Image Management
johnsonabr
Hello,
I have a BIRT report which has charts in it. I need to store these generated images for chart into the database. I am having difficulty finding out the generated image name. I have set the BIRT image directory and images are getting stored there for sure. For now i have a servlet which is serving the image request, this i could easily do by setting the setBaseImageURL of the renderer. Since the generated report has the name of the image in the <IMG> tag i dont have difficulty using the servlet.
But for the proper management of images i need to store them in database. Is there anyway i could get the handle to the generated images after the report has been generated.
Any Help would be appreciated.
Find more posts tagged with
Comments
johnsonabr
I have figured out the solution for this. I would not call it a solution unless approved by any pro. BIRT developer but here is how i achieved this.<br />
<br />
Going through the source code of core BIRT api i figured that there is no way of getting a handle to the images generated for BIRT charts, though it is stored in a map for may be internal use. In a client-server based architecture you would be most probably using <strong class='bbc'>HTMLServerImageHandler</strong> to handle your images so that you can set its base image URL to point to the servlet/REST which will handle image rendering.<br />
<br />
I had a look at the source code for HTMLServerImageHandler, i figured that the image names are stored in a map, which is private and which dont have a getter method to access it. All you have to do is extend the class HTMLServerImageHandler and override the method <strong class='bbc'>handleImage()</strong> and put the image name instead of the url into the map. Reading the source will give you a fair bit of idea how to do it. Lastly you will have to implement a getter method to this map so that you can access the map.<br />
<br />
Just keep in mind that map would only be populated after your task has run.<br />
<br />
Johnson