Loading Image from SQL DB Using GdPictureImaging
Posted: Thu Sep 22, 2016 11:39 pm
I am trying to load an image into a Docuvieware Viewer more or less directly from a SQL DB image blob. We have been able to make this work in a Windows Forms desktop application using VB.NET. I figured I could use a similar strategy for our web portal, since the GdPicture12 Namespace appears to be baked into GdPicture12.WEB Namespace.
Here's what I've done so far:
Default.aspx.cs
The getImage(int) function goes to the database and returns an array of bytes directly from the database. The data is in a SQL Data Type TBLOB(image). The byte array is definitely populating, because I can track it while debugging, but nothing loads into the viewer.
The imageID ends up being 1, so I know CreateGdPictureImageFromByteArray() is "succeeding." If not it would return 0. Further, LoadFromGdPictureImage() returns OK, so everything seems to be going fine, but nothing loads into the viewer.
Any suggestions or thoughts on how to troubleshoot further?
Thanks in advance!
Here's what I've done so far:
Default.aspx.cs
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GdPicture12;
namespace DocuViewareDemo
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Byte[] img = Global.getImage(4579788);
GdPictureImaging g = new GdPictureImaging();
int imageID = g.CreateGdPictureImageFromByteArray(img);
GdPictureStatus status = DocuVieware1.LoadFromGdPictureImage(imageID);
g.ReleaseGdPictureImage(imageID);
}
}
}
The imageID ends up being 1, so I know CreateGdPictureImageFromByteArray() is "succeeding." If not it would return 0. Further, LoadFromGdPictureImage() returns OK, so everything seems to be going fine, but nothing loads into the viewer.
Any suggestions or thoughts on how to troubleshoot further?
Thanks in advance!