Link to home
Start Free TrialLog in
Avatar of LeLeBrown
LeLeBrown

asked on

SSRS report image binary or embedded

I have an SSRS report that displays a person's photo if it is stored in the table. It will be defined as binary. If there is no photo, I want to display a bmp image that just says NO PHOTO. Can you write an expression for an image that will either choose a binary or a embedded image? When I choose image for my report, it requires you to choose database, embedded or external. I created a custom field for my dataset that is named NOPHOTO. When I do the below expression, the binary pic displays fine but the NOPHOTO doesn't display. It has the red X in the top left corner.


=iif(isnothing(Fields!PIC.Value),Fields!NOPHOTO.Value, Fields!PIC.Value)

Thanks
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

While you wait for others to chime in, you can try using a PNG image if the current embedded image is a JPG.  I have read a few of the technet threads and apparently there are known problems with some versions of SSRS and embedded images.  You also can try a BMP.
Avatar of LeLeBrown
LeLeBrown

ASKER

Thanks Kevin. I tried both of those things. I also tried converting my bmp file to varbinary(max) in my query.  CAST('\\SReports\NOPHOTO.bmp' AS varbinary(max))  AS NOPHOTO. When I look at the query results, it shows as binary but still will not display in SSRS.  The other binary image (a photo) displays fine though.
Hopefully someone has a better work around but last ditch option maybe storing the nophoto.bmp as the binary image in DB for the users without a proper image.  Same solution but now you have all images coming from DB. When user uploads new one, it should replace it.
ASKER CERTIFIED SOLUTION
Avatar of LeLeBrown
LeLeBrown

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes might be a limitation.  I don't have any reports with different image sources but have seen many people complaining about same thing you are as I said above, so with luck this will change as there should be enough demand for this functionality to get looked at in future release — at least one would hope.
Glad you found solution. I thought I suggested saving the default image in the database earlier but maybe I did not, so apologies on that but what counts is you got what you need plus shared it here for others.
Hi Kevin,
Sorry, I didn't see that when I closed the question. I should have marked it as assisted. I ended up saving that as binary and then had to play with it to get the if to work.
Solution was assisted. I need to close it as such.
No worries. I truly meant what I said. The important part here is you found a solution. Take care!
Only one person offered a solution and after further research on my own, I found another solution.