Print Page | Close Window

ASP IMG calls HELP!

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=8289
Printed Date: 29 March 2026 at 6:49pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP IMG calls HELP!
Posted By: Necronom
Subject: ASP IMG calls HELP!
Date Posted: 22 December 2003 at 3:19pm

Okay, all I'm trying to do is call an asp page for the source of an image, and I can't get it to work on any three of my servers... any help with what I'm messing up would be greatly appreciated

<!-- Begin source of page1.asp -->

<table width="160 height="120" cellpadding="0" cellspacing="0" border="0">
 <tr>
  <td width="160" height="120">
   <img src="page2.asp?ID=1" border="0">
  </td>
 </tr>
</table>

<!-- End source of page1.asp -->

<!-- Begin source of page2.asp -->

<%
strID = Request.Form("ID") 
strAccessDB = "Pics.mdb"
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)
Set ObjConn = Server.CreateObject ("ADODB.Connection")
objConn.Open strConnect
Set objRec = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblImages.* From tblImages WHERE fldID=" & strID & ";"
objRec.Open strSQL, strConnect, 2, 3
strSRC = objRec("fldSRC")
Response.Write(strSRC)
%>

<!-- End source of page2.asp -->

The error I get is simple...the little box with the X in it. If you just load up the page2.asp file, you are displayed "image.jpg" ; so the db calls are working fine. Also, all SSI's are working fine.

What am I doing wrong?!

. necronom .

ps. sorry for the cross-post...




Replies:
Posted By: MorningZ
Date Posted: 22 December 2003 at 3:47pm

you need to set the output content type to "image", because its going to dump whatever comes out from the database as an image

and
"Also, all SSI's are working fine"

what SSI's are working fine? there's none shown in the code



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Necronom
Date Posted: 22 December 2003 at 4:06pm

oooh ok. I'm trying to call an image that's on the server...not in a db.

so is it possible to call an image not in a db?

and the SSI's are in other scripts. (i didn't know if it mattered, so i just wanted to be clear as possible)

. necronom .

 



Posted By: MorningZ
Date Posted: 22 December 2003 at 5:56pm

<%
strID = Request.Form("ID") 
strAccessDB = "Pics.mdb"
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)
Set ObjConn = Server.CreateObject ("ADODB.Connection")
objConn.Open strConnect
Set objRec = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblImages.* From tblImages WHERE fldID=" & strID & ";"
objRec.Open strSQL, strConnect, 2, 3
strSRC = objRec("fldSRC")
Response.Redirect(strSRC)
%>

 



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: MorningZ
Date Posted: 22 December 2003 at 5:58pm

also, you might want to keep in mind to explicity close DB connections.. good practice when dealing with an Access backend

<%
strID = Request.Form("ID") 
strAccessDB = "Pics.mdb"
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB)
Set ObjConn = Server.CreateObject ("ADODB.Connection")
objConn.Open strConnect
Set objRec = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblImages.* From tblImages WHERE fldID=" & strID & ";"
objRec.Open strSQL, strConnect, 2, 3
strSRC = objRec("fldSRC")
objRec.Close()
ObjConn.Close()

Response.Redirect(strSRC)
%>



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Necronom
Date Posted: 23 December 2003 at 12:10am

Boo-Yah! Thanx...that hit the spot perfectly!

Mucho Gracias!

. necronom .




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net