Home
Analytics
Dynamic Images with Birt
skananth
Hi all,
I am trying to add images dynamically based on a report parameter. I am able to achieve this and have different images to appear depending on the choice. However, I am having issues with image sizing. I have certain images that are distorted and not with proper resolution. Is there a way I could read the image width and height from the file and set those properties in the image field so that it opens up fine.
Any help will be appreciated.
Thanks,S.
Find more posts tagged with
Comments
mwilliams
Are you setting a size on the image element in the designer? I thought it automatically sized itself unless you specified a size.
skananth
mwilliams, no, I am not doing that. I don't have values for the width/height of the image. I have a script for onRender of the image, that would choose the appropriate source file and display it accordingly. I see that the script works fine as I have a change in the image that is getting displayed. However, the size is not getting adjusted well and at times I get the image cropped. <br />
<br />
I also have the "Fit to Container" option set to false in the advanced image properties. <br />
<br />
Could you think of anything that I am probably missing?<br />
<br />
Thanks,S.<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79507" data-time="1309548808" data-date="01 July 2011 - 12:33 PM"><p>
Are you setting a size on the image element in the designer? I thought it automatically sized itself unless you specified a size.<br /></p></blockquote>
mwilliams
Can you attach a sample report and a couple images that will show your issue, so I can test on the report? Thanks.
gunasekar
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79602" data-time="1309873269" data-date="05 July 2011 - 06:41 AM"><p>
Can you attach a sample report and a couple images that will show your issue, so I can test on the report? Thanks.<br /></p></blockquote>
Hi Williams,<br />
<br />
Please reply for this link<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/22785-how-to-give-colors-for-the-categories-of-pie-chart/'>http://www.birt-exchange.org/org/forum/index.php/topic/22785-how-to-give-colors-for-the-categories-of-pie-chart/</a><br
/>
<br />
thanks in advance
skananth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79602" data-time="1309873269" data-date="05 July 2011 - 06:41 AM"><p>
Can you attach a sample report and a couple images that will show your issue, so I can test on the report? Thanks.<br /></p></blockquote>
<br />
I have attached the pdf file of the report. The header in this case is FB logo. If I replace it with any other logo, it doesn't automatically re-size. <br />
<br />
Thanks for the assistance,<br />
skananth.
skananth
<blockquote class='ipsBlockquote' data-author="'skananth'" data-cid="79745" data-time="1310056126" data-date="07 July 2011 - 09:28 AM"><p>
I have attached the pdf file of the report. The header in this case is FB logo. If I replace it with any other logo, it doesn't automatically re-size. <br />
<br />
Thanks for the assistance,<br />
skananth.<br /></p></blockquote>
<br />
Here is the attachment.
mwilliams
Could you create a sample report design that I can run along with a couple of images of your choosing that illustrate the issue for me so I can test on a report with the issue you're having? Thanks!
skananth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79771" data-time="1310066407" data-date="07 July 2011 - 12:20 PM"><p>
Could you create a sample report design that I can run along with a couple of images of your choosing that illustrate the issue for me so I can test on a report with the issue you're having? Thanks!<br /></p></blockquote>
<br />
<br />
Sure mwilliams. I am attaching the .rptdesign file of this generated report. Though the data might not show up, you can work with the header with the logo which is what I need. <br />
<br />
I will also attach 2 logos for you to test the same. You can see that the logos don't re-size themselves and looks too absurd to view. <br />
<br />
Thanks,<br />
skananth.
skananth
<blockquote class='ipsBlockquote' data-author="'skananth'" data-cid="79775" data-time="1310068918" data-date="07 July 2011 - 01:01 PM"><p>
Sure mwilliams. I am attaching the .rptdesign file of this generated report. Though the data might not show up, you can work with the header with the logo which is what I need. <br />
<br />
I will also attach 2 logos for you to test the same. You can see that the logos don't re-size themselves and looks too absurd to view. <br />
<br />
Thanks,<br />
skananth.<br /></p></blockquote>
<br />
You could use this particular report design that I attach in this post and ignore the previous one. Sorry for the confusion.
mwilliams
You have a width set on the containing grid of the image. It will only get as big as the container it's in. If you used a 1 column grid and chose "center" for the horizontal alignment, you shouldn't have any issues with the image adjusting itself without you setting a size. Below is the script I used to change the image when I tested:
if (params["imageSelector"].value == 1){
this.file = "facebook.jpg";
}
else{
this.file = "apple.jpg";
}
skananth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79849" data-time="1310157334" data-date="08 July 2011 - 01:35 PM"><p>
You have a width set on the containing grid of the image. It will only get as big as the container it's in. If you used a 1 column grid and chose "center" for the horizontal alignment, you shouldn't have any issues with the image adjusting itself without you setting a size. Below is the script I used to change the image when I tested:<br />
<br />
if (params["imageSelector"].value == 1){<br />
this.file = "facebook.jpg";<br />
}<br />
else{<br />
this.file = "apple.jpg";<br />
}<br /></p></blockquote>
<br />
Thanks a lot mwilliams. That solved my problem
Great form and great job! Thanks again for the assistance. I got another question as well. But I have just found a topic already and would post there.
mwilliams
Not a problem, glad to help!