Showing a Blob in an IMG tag

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
In the old ASP i used an ASP url to show a blob in an IMG tag
I cannot seem to ge it working well in asp.net
Anyone having an example url or a little sample code
I want to put this in an usercontrol or something like that
Regards
RJ
 
Hi RJ,
there has been many talks about it. In short words, from html page you
reference aspx file instead of jpg, gif or whatever. On this aspx page you
simply go to DB, retrieve image data, and return it through response. Check
http://weblogs.asp.net/cazzu/archive/2003/08/27/25568.aspx, however there
are many other links

What are you exactly having in mind when you say usercontrol?

Igor Kramaric
 
Hi RJ,
there has been many talks about it. In short words, from html page you
reference aspx file instead of jpg, gif or whatever. On this aspx page you
simply go to DB, retrieve image data, and return it through response. Check
http://weblogs.asp.net/cazzu/archive/2003/08/27/25568.aspx, however there
are many other links

What are you exactly having in mind when you say usercontrol?

Igor Kramaric
 
Hi Igor,
first of al thnx for the response The technique you discribe is the same i
use in ASP. What i meen with the usercontrol is that i make an usercontrol
showing a block with info from a database.
This info als has a reference to the blob. The blob will be shown in the way
dscribed. What i meen is this. In the aspx page showing the image. Do i have
to use the system.drawingimage class or just use the old way n using
response.binarywrite.

Regards,
RJ
 
RJDev said:
Hi Igor,
first of al thnx for the response The technique you discribe is the same i
use in ASP. What i meen with the usercontrol is that i make an usercontrol
showing a block with info from a database.
This info als has a reference to the blob. The blob will be shown in the way
dscribed. What i meen is this. In the aspx page showing the image. Do i have
to use the system.drawingimage class or just use the old way n using
response.binarywrite.

The old way: BinaryWrite. You might want to set some headers, like
Content-Type and maybe Content-Disposition.

DrawImage is used "client-side" to draw an image on the screen (or another
image)

Hans Kesting
 
Use the old technique and it works fine.
I only cannot use an ascx page (webUserControl_) Only an normal aspx page
works:

Now just use the simple way and works fine for almost all picture.

____________________________________________________________________________
________________________________
Dim Ids As String = Request.QueryString("ID")
Dim Wb As New OrmadinASP.Net.WebConnection
'If Wb.IsNullString(Ids) = True Then Ids = 1

If Wb.IsNullString(Ids) = False Then

Dim Cn As New MySqlConnection
Dim Dr As MySqlDataReader
Cn = Wb.WebConnect(False)
Dim Cmd As MySqlCommand = New MySqlCommand("SELECT ID, type, image from
blobs where ID = @Ids and enabled=1", Cn)
Cmd.Parameters.Add("@Ids", MySqlType.Int)
Cmd.Parameters(0).Value = Convert.ToInt16(Ids)
Try
Cn.Open()
Dr = Cmd.ExecuteReader(CommandBehavior.SequentialAccess)
If Dr.Read Then
With Response
..ContentType = Dr.GetString(1)
..BinaryWrite(Dr(2))
End With
End If
Dr.Close()
Cn.Close()
Catch Exc As Exception
'
End Try
Else
'
End If

____________________________________________________________________________
________________________________
The MySQL provider can be switches with the SQLprovider.

Regards,
RJ
 
Back
Top