0

I wanted to export a report with image. The stored image is in URL format in DB.

My alternative is download the file physically and pass the file path in to show the image, but this way seem redundant. Sample from here

What would be the best way to do this? Many thanks!

Kevin Ng
  • 448
  • 5
  • 13
  • https://stackoverflow.com/questions/43380961/ssrs-how-to-show-external-image-based-on-url-inside-column – Dale K Feb 15 '19 at 03:11
  • I tried directly put the full URL as value, but it doesn't show anything. I'm using Visual Studio to build RDLC, do I need to allow any permission for this? I configured ReportViewer1.LocalReport.EnableExternalImages = true; anything else? – Kevin Ng Feb 15 '19 at 03:38
  • 1
    Reason of this not working is because Content-Type of my URL was set to Content-Type: application/octet-stream, not Content-Type: image/jpeg. Therefore, it will not show in the report. – Kevin Ng Feb 18 '19 at 05:39

1 Answers1

0

I end up using the code below to download the image and convert it into base64 before I display in RDLC.

var webClient = new WebClient();
byte[] imageBytes = webClient.DownloadData(urlimg);

DataRow drow = table.NewRow();

drow["filepath"] = Convert.ToBase64String(imageBytes);

RDLC are configured as image below. RDLC configuration

Kevin Ng
  • 448
  • 5
  • 13