Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP IMG calls HELP!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP IMG calls HELP!

 Post Reply Post Reply
Author
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post Topic: ASP IMG calls HELP!
    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...

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post 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 .

 

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Necronom View Drop Down
Groupie
Groupie


Joined: 19 October 2001
Location: United States
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote Necronom Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2003 at 12:10am

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

Mucho Gracias!

. necronom .

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.