Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add an image to an SSRS report with a dynamic url?

I'm trying to add an image to a report. The image src url is an IHttpHandler that takes a few query string parameters. Here's an example:

<img src="Image.ashx?item=1234567890&lot=asdf&width=50" alt=""/>

I added an Image to a cell and then set Source to External and Value to the following expression:

="Image.ashx?item="+Fields!ItemID.Value+"&lot="+Fields!LotID.Value+"&width=50"

But when I view the report, it renders the image html as:

<IMG SRC="" />

What am I missing?

Update

Even if I set Value to "image.jpg" it still renders an empty src attribute. I'm not sure if it makes a difference, but I'm using this with a VS 2008 ReportViewer control in Remote processing mode.

Update

I was able to get the images to display in the Report Designer (VS 2005) with an absolute path (http://server/path/to/http/handler). But they didn't display on the Report Manager website. I even set up an Unattended Execution Account that has access to the external URLs.

like image 526
jrummell Avatar asked Dec 02 '09 16:12

jrummell


People also ask

How do I add an embedded image to an SSRS report?

The embedded image will always be available to that report and listed in the image manager panel. Follow these steps to add an image to an SSRS report using the image manager panel. Click the image manager panel icon in the configuration panel. Click ADD IMAGE. Browse for and select an image in the local disk and then click Open .

How to add a hyperlink in SSRS report?

Steps to add a hyperlink in SSRS report: In report design view, right-click the text box, image, or chart to which you want to add a link and then click Properties. 2. In the Properties dialog box, click the Action tab and select URL.

How do I add a dynamic image to my report data?

All that’s left is to do is add the new column that will house the dynamic image. -Chosen the images and they are ready to be imported. First, import the images. Second, add a column. Third, update the row properties. Ensure the Report Data window is open, right-click on the Images node and select Add Image…

How do I serve dynamic images to the SSRs RDL?

Since images cannot be built dynamically in SSRS with an RDL file, we will use our .NET HTTP RESTful application to serve dynamic images to the SSRS RDL, but the decision of what image is to be served will be made based on the parameter supplied by RDL. How?


2 Answers

I have a SSRS Report that displays the information about the countries of the users of a site that we support at work. This is based on the IIS log data. On this report, in the first column of the table is an image field that holds a small .gif of the flag for each country. I was running into the same exact issue described in the question above. The path to the external image was calculated in the report’s query based on the country code. I initially setup the URL to point to something like http://www.mystaticcontent.com/fotwimg/us.gif for a United States flag and so forth. All I got was a red X broken image displayed in the report. Then I found this MSDN article that shined some light on the issue for me.

This is what I did with the report to make it work:

  1. Moved the fotwimg folder that has all the gifs from the static content server to the local SSRS machine, which also has a web server running on it.
  2. Setup a virtual directory on the default web site in the local SSRS machine IIS Manager.
  3. Then I changed the report query to refer to the image in the local SSRS machine, by machine name, like this http://mylocalssrsmachine/fotwimg/us.gif
  4. Voila, it works… or at least it worked for me.
like image 176
λ Jonas Gorauskas Avatar answered Sep 30 '22 12:09

λ Jonas Gorauskas


Have you tried using a fully qualified path?

http://<servername>/images/image1.jpg

More Info

like image 30
jimconstable Avatar answered Sep 30 '22 13:09

jimconstable