Introduction
When I needed to use dynamic images in my web site I followed Gayan Mudalige article on "Displaying multiple dynamic images in a WebForm". Using this very clever method I build a completly dinamic web site for one of my clientes.
When my client came back and asked me to do the same but with HTML Emails, i didn't knew what to do. Actually I was about to to tell him it had to be done trought a third party extension when I remembered gayan tecnic for dinamic images.
Basically, use and <img> block in the html code you send with the email. In the "src" property you put the url of a page in your ASP.NET application.
Ex: src="http://mypage.com/images/dinamicImages.aspx?id=5"
This Page contains a couple of lines of code that loads the image from the data base and puts in an indivudual web page which becomes an image, and the image url.
'Use this Code in the individual blank aspx page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
If Not Request.QueryString.Item("Id") Is Nothing Then
Dim id As Integer
id = Request.QueryString.Item("Id")
If id > 0 Then
Me.ShowImage(id)
End If
End If
Public sub ShowImage(ByVal id As Integer)
Dim foto As New ProviderProductosFotografias
Dim ds As New DataSet
Dim funciones As New Functions
If funciones.DataSetHasTablesAndRows(ds) Then
Response.BinaryWrite(buffer)
Dim buffer() As Byte = ds.Tables(0).Rows(0).Item(0)
End If
<IMG style="WIDTH: 224px; HEIGHT: 160px" height="160" alt=""
src="http://www.mypage.com/ShopOnLine/UI/Pages/Modulos/ImageMultiDb.aspx?id=5"
>http://www.mypage.com/ShopOnLine/UI/Pages/Modulos/ImageMultiDb.aspx?id=5"
'This example assumes images will be used only once in each email, so
'there is no need for storing for repetitive use.
End Sub
ds = foto.getData("Select imagen from fotografias where fotografiaid=" & id)
End Sub
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.