Dynamic Image Problem
Can anyone spare a few moments to help me out. Whilst working my way through âBeginning ASP 3.0â I am trying to construct some pages of my own. I need to display a jpg image from a reference to it which is stored in a database table. Later I intend to add a form which lets the user select the image they want but, at this stage I want to display, as default, the image which is named in the last record of the table.
The book doesnât seem to deal with dynamic images at all so could you take a look at my code or suggest where I might go to find out how to do this.
<% Option Explicit %>
<!-- METADATA TYPE="typelib"
FILE="c:\program files\common files\system\ado\msado15.dll" -->
<title>Cracked Flag MuzikMaze</title></head>
'To select and display the latest MuzikMaze puzzle by collecting
'the name of the jpg file from the last record in rant.mdbâs MuzikMaze table.
Dim objConn, objRS, strJPGFilename
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.RecordSet")
objConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Persist Security Info=False"
objRS.Open "Muzikmaze" , objConn, adopenStatic, adLockReadonly, adCmdTable
strJPGFilename = "MuzikMaze/"& objRS("Filename") &".jpg"
Response.Write "<img src=" & strJPGFilename & ">"
Set objRS = Nothing
Set objConn = Nothing
All I get in explorer is an image placeholder with a red cross. Obviously not right there!
If I change the key line Response.Write toâ¦
Response.Write â<img sce = â & EVAL(strJPGFilename) & â>â
Then I get this messageâ¦
Microsoft VBScript runtime (0x800A01F9)
Invalid or unqualified reference
Am I even on the right lines?
All help gratefully received