How to get external image with root-site relative address to appear in BIDS?

  • My IT shop has been using a logo image stored in a database, but is trying to switch over to using a .jpg file on the report server. It appears that the only way to reference such a file is with an external image. I have to use a root-site relative address, because my IT shop adds a screwy extra folder layer in the test environment. I can't simply go up set number of folders.

    I can successfully deploy reports and get the logo to appear in Report Manager. My only problem is that the image does not appear in BIDS 2008. It is a red X in Design view and previewing the report causes an error because it can't find the image. I can't quite figure out what BIDS considers to be the root site when it emulates the Report Manager environment.

    The root-site relative address I am using looks like this:

    /Images/logo.jpg

    I have tried putting this file in various places on my local machine without success. Do I need to create a virtual directory in IIS for the Images folder? I doubt it, since SSRS 2008 supposedly no longer depends on IIS. Suggestions?

  • When the JPEG is in the database I think you need to put it in a rectangle to use it in a report, so if you are getting red x you need to change the size of the JPEG file and use a rectangle. If this is a logo you must check the SSRS header and footer restrictions in the BOL. There is a style folder you can modify in SSRS folder in Microsoft SQL Server folder. There is a long thread about the style folder I will post it later.

    Kind regards,
    Gift Peddie

  • I don't think any of the suggestions offered address my problem. I think maybe you misunderstood. The reports in question are in production and are successfully getting the logo from the database and displaying it in the header just fine. That's not why we want to migrate away from using the database as a source for the image.

    I was able to solve my problem myself. A little experimentation with expressions to dump Globals!ReportServerUrl and Globals!ReportFolder into a textbox proved that these globals evaluate to empty strings when in Visual Studio. This fact convinced me that Visual Studio isn't likely to support any type of relative URLs for Reporting Services projects, regardless of whether they are the site-root variety or not. (Yes, I mistakenly flipped the word order of "site-root" in my original post.)

    I solved my problem by writing an expression for the Value property of the image.

    =Iif(Globals!ReportServerUrl="",="file://C:/Data/Images/logo.jpg",="/Images/logo.jpg")

    ' In Visual Studio, use an absolute file URL. When deployed

    ' to an actual report server, use a site-root relative URL.

    There may be a better solution, but will one will do. I hope this helps somebody else!

  • I was able to solve my problem myself. A little experimentation with expressions to dump Globals!ReportServerUrl and Globals!ReportFolder into a textbox proved that these globals evaluate to empty strings when in Visual Studio. This fact convinced me that Visual Studio isn't likely to support any type of relative URLs for Reporting Services projects, regardless of whether they are the site-root variety or not. (Yes, I mistakenly flipped the word order of "site-root" in my original post.)

    The code you posted is different from what you posted as your problem, the code you posted your issue is just the image path and location of the image. Good to see your problem is resolved.

    Kind regards,
    Gift Peddie

  • I have one last post on this topic to add a small refinement.

    =Iif(Globals!ReportServerUrl=""

    ,="http://your_development_server/Reports/Images/Logo.JPG"

    ,="/Images/logo.jpg")

    ' When previewing in Visual Studio, use an absolute URL for the dev server.

    ' When executing on an actual report server, use a site-root relative URL.

    In Visual Studio, absolute HTTP-type URLs work fine. The revised code above has two advantages over the original. 1) It does not force developers to have a copy of the image file on their local machines. 2) The code executed when previewing in Visual Studio is closer to the code used when running under Report Manager, so there is a little less risk of gotchas when migrating a report.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply