Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load an image from an ASP script??

Status
Not open for further replies.

DOGWATCH

Programmer
Mar 11, 2004
120
0
0
US
Problem:
I want to be able to display an image on a web page that is pointed to a ASP script. For example.

<img src="
firstimage.asp
This file should recall a URL from the database that points to an image.

I've seen this done in PERL and I assume it can be done with ASP any ideas or code snippets?
 
Ah you'll want to make a ASP that has no html interface ... that has no webness

The script on the page will determine which image file and then set the MIME type to the appropriate thing so it isn't the default "text/html" ... perhaps "image/jpeg" would work for you. Then you read the bytes of the file into the response object.
 
The examples shown are storing the images in a SQL blob which is not really the direction I want to go.

I want to recall images and or documents from a .ASP link. for example image would be shown as
<img src="
and for documents I would show this link

<a href=" Schedule</a>

The idea is that you would have a font end static HTML page with these links on it that never change. On the back end i would have an ASP admin screen where documents and images would be uploaded.

I know there is a way to do this in ASP because I have done it before serveral years ago. I just can't recall my old code.
 
So you don't want to store the file itself in the database?

Instead will you save the file path in the database and have the file just out in the filesystem?

If so then you need a way to get a binary stream so the plain FSO won't help ... you can abuse the ADO recordset ... force it to give you a stream by telling it to load from file then taking the stream... doesn't matter that the file is not actaully a persisted recordset... thats why it is abuse. heh.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top