Displaying a photo stored in an SQL database as a varbinary (max) field
I am trying to display photos taken by inspectors in map tips. When the inspectors collect data (including photos), it is stored in our SQL database. We have certain locations where the inspectors collect data on a regular basis, so the data collected for each visit is stored in a different table than the actual location data (name of location, etc). The locations are published as a service, and there is a one-to-many data link set up to display the data from the most recent record in the map tips.
However, we would also like to display any pictures inspectors took in the map tips. The pictures are stored in a varbinary(MAX) field in our SQL database. I can get the raw alphanumeric data to display in the map tip, but I can't get it to render.
After a Google search, I found a website with code to display binary data using the following format:
<img src="data:image/jpeg;base64,{binary data}">
https://ben.lobaugh.net/blog/33713/using-binary-image-data-to-display-an-image-in-htmlWhen configuring the map tips in Manager, the picture rendered properly in the editor. However, it did not show up in the actual map tips.
I searched the forum and found the following post, but the table with the inspection records in it is not actually published as a service, so I don't think that method will work for me.
https://support.geocortex.com/essentialsGSCForum?id=906f2000000fxaUAAQ
Does anyone have any other ideas for displaying the pictures in map tips?
Thank you,
Denise
0
-
Hi Denise,
To display an image in a map tip, you should be able to specify something like the following:
<img src="{binary data}" style="width:300px; height:200px;"/>
It may not be showing up in the map tip in the viewer due to the size of the image being too large.
- Matt Hodgson0 -
Hello Matthew,
Thank you for your response! I tried adding the code you suggested to my map tips, but it didn't quite work. There is a box for the picture, but it did not load. It was obviously pulling the data, because it took about 8 seconds for the date field to populate (it's being pulled from the same datalink) when I clicked on a point that has a picture in the linked table. When I clicked on points without photos, the dates populated instantly.
I tried decreasing the size to 150x100, but it still didn't work. Do you have any other suggestions on why it might not be displaying?
Thanks,
Denise
0 -
Same result for me, the frame shows up, but the photo doesn't. Similar situation to Denise's, in my case I'm trying to pull in photos our Assessing team took and stores in CAMAvision, using a data link to link them to our GIS parcel dataset using parcel ID and display the latest photo in the pop-up. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
3 Kommentare