Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
External Images in SSRS Reports Part two of a two-part series of blogs |
---|
In an SSRS report you can display images stored in an external location. This blog explains how to show images from both the report server and external websites in your SSRS reports.
|
In this blog
Storing images on a report server gives you control over the files meaning that you don't have to rely on an external website to never change. This part of the blog series shows you how to upload images to a report server and how to reference them in your reports.
A report server can store more than just reports!
It makes sense to organise your images into folders on the report server. To create a folder, navigate to the SSRS web portal in a web browser and choose the menu option shown below:
From the menu, choose New | Folder.
Give the folder a sensible name then click Create to create it.
Enter a name for the folder then click this button.
Your new folder will appear in the web portal.
You can click on the folder to see its contents.
You can create as many folders as you need. For this example, I've added a Certificates folder inside the Images folder.
The Certificates folder is a subfolder of Images.
Navigate to the folder you want to upload your files to and then select the menu option shown below:
Click Upload to begin choosing files to upload.
Select an image file (annoyingly, you can pick only one at a time) and click Open to upload it.
Note that the image files have the same name as the certificate names stored in the database.
The image file will appear in the web portal.
You can click on the image to view it in your browser.
Repeat this process for each image you want to upload.
You can read this blog to find out how to upload multiple images at the same time.
To refer to an image stored on the same report server as a report, you need to provide the path to the image. Here's what this looks like for the 12A.png file:
/Images/Certificates/12A.png
You could store these paths in the database, as we did for the images stored on an external website.
The ImageServerPath column contains the path to each certificate's image.
You can then configure an image to refer to this path in the same way as for images stored on an external website.
Set the image to use the path stored in the database.
If you preview the report in Visual Studio, you'll find that the images appear to be broken.
The local copy of the report file doesn't display the image files correctly.
To see the images working correctly, deploy the report to the same report server as your images and view the report in the web portal.
The deployed report can access the images on the same report server.
You can also see the images working correctly if you preview the report in Report Builder, providing that Report Builder is connected to the report server containing your images.
Rather than storing the image path in the database, you could use an expression to calculate it. This example relies on the names of the image files matching the names of the certificates in the database. To calculate the path in the SQL query which populates the dataset, you could do something like this:
select
f.Title
,f.ReleaseDate
,c.Certificate
,concat('/Images/Certificates/', c.Certificate, '.png') as ImageServerPath
from
dbo.Certificate as c
join dbo.Film as f on c.CertificateID = f.CertificateID
Alternatively, you could calculate the image path in the report. To do this, use the Expression Builder when configuring the image object.
Click the fx tool to open the Expression Builder.
You can then create an expression like this:
Expressions in a report are written in Visual Basic.
Storing images on a report server provides a more reliable way to display images in an SSRS report. You can repeat the process to display as many images in a report as you like.
Perhaps this is a little over the top!
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.