Dynamically read images from share path and display in report

  • Hi 
    Will it be possible to display the images in SSRS from FTP path ?

    Two table invoice  & image_info
    -- table invoice
    Invoice number and other info
    123,.......
    124,.......
    --table image_info
    Invoice number , image_id
    123                    500
    123                    501
    123                    502
    124                    503
    124                    504
    124                    505
    124                    506
    124                    507
    mysharepath : \\myip\\folder\\images\\invoice\\ 
    there are around 10 million images are there.. 
    If Invoice number is given as 123 i need to display 3 images reading them from my share path in SSRS
    If Invoice number is given as 124 i need to display 5 images reading them from my share path in SSRS
    Is it is possible to read the files from the share path in the run time with image Ids'(in this case) and show in the report ?

  • Check the following Link

  • Thanks for sharing the link.
    This one is generic reading of file.. 
    for my case it is dynamic .. 
    will it is possible to read the files from the share path in the run time and show in the report SSRS ? 

  • yuvipoy - Wednesday, August 30, 2017 3:38 AM

    Thanks for sharing the link.
    This one is generic reading of file.. 
    for my case it is dynamic .. 
    will it is possible to read the files from the share path in the run time and show in the report SSRS ? 

    Well, you need to check if it works for you. If it those then next step is to how to make it dynamic,
    You need to get the complete path from select query, Something Like this.

    WITH CTE (InvoiceNumber , image_id)
    AS
    (
    select 123, 500    union
    select 123, 501    union
    select 123, 502    union
    select 124, 503    union
    select 124, 504    union
    select 124, 505    union
    select 124, 506    union
    select 124, 507
    )

    select InvoiceNumber, image_id, + '\\myip\\folder\\images\\invoice\\' + Cast(image_id as varchar(20)) + '.png' AS DynamicPath
    from CTE

    and then pass this dynamic address to the code.

  • Unfortunately the above link  did not worked for me. 🙁 🙁 

  • yuvipoy - Wednesday, August 30, 2017 7:45 AM

    Unfortunately the above link  did not worked for me. 🙁 🙁 

    And why is that?


  • Getting the above error while i done this.

    I have tried in local path instead of shared path the result is same.

  • Hi all,
    Can you assist with the error received here ?
    I am unable to move further.

  • yuvipoy - Thursday, August 31, 2017 4:29 AM


    Getting the above error while i done this.

    I have tried in local path instead of shared path the result is same.

    you should be using Image control instead of textbox. that's why your expression is not validating.

    Just want to confirm that, whether you want to get these images from ftp directly or you want to load them from any shared folder? Reason i am asking this is because in your original post you mentioned FTP.
    Link contain all the information if you want to get the data directly from FTP. You need to follow all the instruction in that link if you want to work it with FTP.

    Please do consider your approach as this will execute for each row you have in your report. Getting image directly from FTP can slow down your report. Hope it helps.

  • I found two ways of displaying images .. First i tried with local path
    Way :I 

    Create Table image_f (Id varchar(100),Image_id int , image_pic image)
     Insert into image_f
    SELECT '00123',456, * FROM OPENROWSET(
    BULK N'D:\Images\Test\456.png',
    SINGLE_BLOB
    ) rs;

    in DataSet--> DataSource --> Query Type --> Text
    SELECT   image_pic as test FROM    image_f
    it is displaying in SSRS report(Deployment mode) and not in Internet Explorer (IE11.0) i tried changing IE version but it did not work for me.
    Way :II
    in DataSet--> DataSource --> Query Type --> Text
    Select 'File: D:\Images\Test\456.png' as test and have choose image from tool & in its property "Select image source as" EXTERNAL and it is displaying in Deployment mode as well as in IE.
    but the same when i create the stored procedure and ran it is not displaying the result 
    😀
     😀
    how to proceed further here ??

  • yuvipoy - Friday, September 8, 2017 5:34 AM

    I found two ways of displaying images .. First i tried with local path
    Way :I 

    Create Table image_f (Id varchar(100),Image_id int , image_pic image)
     Insert into image_f
    SELECT '00123',456, * FROM OPENROWSET(
    BULK N'D:\Images\Test\456.png',
    SINGLE_BLOB
    ) rs;

    in DataSet--> DataSource --> Query Type --> Text
    SELECT   image_pic as test FROM    image_f
    it is displaying in SSRS report(Deployment mode) and not in Internet Explorer (IE11.0) i tried changing IE version but it did not work for me.
    Way :II
    in DataSet--> DataSource --> Query Type --> Text
    Select 'File: D:\Images\Test\456.png' as test and have choose image from tool & in its property "Select image source as" EXTERNAL and it is displaying in Deployment mode as well as in IE.
    but the same when i create the stored procedure and ran it is not displaying the result 
    😀
     😀
    how to proceed further here ??

    Regarding Way 1:
    1. Change "image_pic" column data type  to "VARBINARY(MAX)" Instead of "Image".
    2. Add a new Column "MimeType" of data type VARCHAR(50) to store what kind of image you want to show. As per your example it should be  "image/png".
    3. Check this link for complete working Rendering images from a database on SSRS reports

    Regarding Way 2:
    1. Make Sure you use UNC path to the files where you have stored images ,and give the ssrs service account enough permissions to that folder.
        Check out following SSRS Tutorial Part 59.1- How to use External Image in SSRS Report (Its a Video)
        Check out following We can insert image in report , what image sources are available for us to use in SSRS Report - SSRS Interview Questions and Answers ( Check the bottom section of this article).
    2. You might check SSRS log file to see if there is any error behind the scene while running the report. for more detail Reporting Services Log Files and Sources

    Hope it helps.

Viewing 11 posts - 1 through 10 (of 10 total)

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