Image attributes

  • Thread starter Thread starter Rob T
  • Start date Start date
R

Rob T

I have a page that can upload or display a particular image from a SQL
server....works fine. Data is stored as a binary data type.

I'm looking for a simple way to find out what some of the attributes of the
image are, such has the size, x & y dimensions.

Thanks. -Rob T.
 
You would probably want to load the image into a System.Drawing.Image, and
get these attributes from the properties of the instance.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Thanks. I'm not too familiar with playing around with images..is there some
place you can point me to on loading SQL images into a bitmap? Thanks.

PS.
The current code I use to display an image is something like this...

Dim cnnCUS As SqlConnection 'connection to the CUS DB
Dim strSQL As String 'text SQL statement
Dim cmdSQL As SqlCommand 'SQL command
Dim dtrRS As SqlDataReader 'Data reader (record set)

cnnCUS = New SqlConnection(Session("cnnCUS"))

strSQL = "select Img, ImgType from FormImg where ImgID='" &
Request("ImgID") & "'"
cmdSQL = New SqlCommand(strSQL, cnnCUS)
cnnCUS.Open()
dtrRS = cmdSQL.ExecuteReader
If dtrRS.Read = True Then
Response.ContentType = dtrRS.Item("ImgType")
Response.BinaryWrite(dtrRS.Item("Img"))
End If
dtrRS.Close()
cnnCUS.Close()
 
Back
Top