External images in a report

I have a report that has one image control that is set for External files. I am using localreports and EnableExternalImages is set to true. I have a dataset with a table that contains the database fields which are in an Access database. The name of the image is stored in the database. I am trying to concatinate the relative path with the with the name of the image from the datatable. Here is the Image portion of the report file:

<Image Name="imgProjectPicture">

<Sizing>Fit</Sizing>

<Left>5.4in</Left>

<Top>1.25in</Top>

<Width>2.65in</Width>

<Source>External</Source>

<Style>

<BorderStyle>

<Default>Solid</Default>

</BorderStyle>

<BorderColor>

<Default>Navy</Default>

</BorderColor>

</Style>

<Height>2.95in</Height>

<Value>="~/ProjectImages/" + Fields!Pic1.Value.ToString</Value>

</Image>

I have also tried puting the "file:///" desination in first part of the value field, which don't. I can hard code the image path and it works fine, but I don't want to create a report for every project we need these reports for.

Any help would br very much appricated,

Thanks, Todd



Answer this question

External images in a report

  • Rafael Justo

    Are you trying to use a relative path to images stored directly on the report server
    In that case the path must either start with a "/" to start from the root of the report server, or directly with the subfolder name in case of a relative path.

    -- Robert



  • Cindy Winegarden

    Thank you for your quick response!

    The images are stored in a folder within my asp.net 2.0 project, sorry I didn't mention the asp.net part before, in a folder called "ProjectImages". The value field for the image control is set with:

    "<Value>="~/ProjectImages/" + Fields!Pic1.Value.ToString()</Value>".

    If I set this to a value in a text control in the report I can see the relative path is there. However it will not display the image.

    Being new to creating reports I'm not sure if I have a report server working, but I don't think I do. I am using Visual Web Developer Express with the ReportViewer control installed.

    Again, I am storing the image names in an access DB and trying to concatinate the relative path with the image into the value of the image control.

    Todd


  • nobodyman

    I found a post that answered by question!

    The solution I found was to use the http:// address of where the image file is and concatinate the image file name from the dataset field. This is actually an absolute path solution, but it works. If someone knows a relative path solution I would be insterested in seeing it.

    Todd


  • Habbit

    Please include where you found the solution. I haven't been able to find enough information to use an external url. Your settings for an external image wouldn't compile in my current project. I eventually solved this by going to an embedded image but it wasn't my preference to do this. Any help would be appreciated.


  • External images in a report