How can I bind the WebImageViewer to an image stored in a database (not a link to a file on the filesystem)? Any help would be appreciated. I set the datasourceid to the connection and the datamember to the field containing the image. I try to run it and get an error:
Hello Scotte,
That would be a wonderful feature, however this is really very hard to implement. All WebImageViewer does is provide the means to show a galley of picture, which render as pure <img> Html tags. The nature of Html requires that the images used should be physically present as files on the Web-Server, so supporting binary/image files directly in database is not possible.
Storing images directly in database and then showing them in browsers is a very tricky topic, but I believe this is a good starting point:
http://www.stardeveloper.com/articles/display.html?article=2001040401&page=1
Actually it would not be all that hard to implement. If you look at any one of the template club websites microsoft provides they do this exact same thing. The images are stored in a database and they show it in the webpage without saving it to disk. The reason I know this is because that is how I am doing it now and really wanted to use your control instead. Do you know if the control will accept a filestream object rather then point to an actual file? If so then I can probablly create a workaround.
So while I am not exactly sure how this is implemented in Microsoft samples, I guess they are using a streamer file (aspx) page to stream binary image content? Then maybe, you can try something similar in Page_Load:
if (!Page.IsPostBack) { WebImageViewer1.Items.Add(new ImageItem("ImageStreamer.aspx?imageID=1", "alt", "tooltip")); WebImageViewer1.Items.Add(new ImageItem("ImageStreamer.aspx?imageID=2", "alt", "tooltip")); WebImageViewer1.Items.Add(new ImageItem("ImageStreamer.aspx?imageID=3", "alt", "tooltip")); }
Provided ImageStreamer uses the imageID get parameter to figure out which image to stream from database. Will this help?
Thanks for that last suggestion Rumen. It worked.
I'm attempting to do the same thing but not working for me with version 10.3. I have a streamer file (aspx) page to stream binary image content. Anything wrong with my code below?
Control:
<ig:WebImageViewer runat="server" ScrollAnimations-Type="Page" ID="PhotoGallery"></ig:WebImageViewer>
Code behind:
PhotoGallery.Items.Add(New ImageItem("ViewImageFromBinary.aspx?ImageGUID=" & imageGUID, "alt", "tooltip"))