Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Image Size from SQL Server image field

Status
Not open for further replies.

Piedtyper

Programmer
May 13, 2001
3
CA
Help.

I'm trying to customize a ColdFusion custom tag (a specialized dll). The tag pulls binary image information from a SQLServer image field via an ODBC connection and blasts it out to the a file. This all works right now.

What I would like to know is how to get the height and width of the image so I can pass those values back. The data is being read into the variable Data of type UCHAR defined:

Code:
UCHAR        Data[BUFFERSIZE];

Just before the data is written to the file I would like to compute the height and width of the image. I assume differing types of images will have different methods of getting the dimensions. Currently the tag doesn't distinguish the image type but just blasts it out to a file. If possible I would like this to work for jpeg and png images.

I'm not sure if this is helpful but here is a snippet of the code that writes the file:

Code:
if (cbBinSize > (BUFFERSIZE -1))
   out.Write(Data,BUFFERSIZE-1);
else
   out.Write(Data,cbBinSize );
   retcode = SQLGetData(hstmt1,	// hstmt
   1,		   // ipar
   SQL_C_BINARY,   // fCType
   Data,	   // rgbValue
   cbBatch,	   // cbValueMax
   &cbBinSize);    // pcbValue

Any help is greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top