Click to See Complete Forum and Search --> : [RESOLVED] return an image as a ASP response?


aaron.martinas
04-17-2007, 09:04 AM
in php, it is highly documented that one can do the following:

<img src="somepage.php">

and based on the code of the PHP page, you can return an image (random, in most instances that ive seen used, but i know thats all simply a result of the coding and could be whatever, whenever, whereever.)

so my question is this: is there an ASP equivalent? i dont want to use GDI libraries or anything-- i'd just like to return one of several static, premade images based on dynamic factors utilizing the ability to manipulate the header that is returned.

aaron.martinas
04-17-2007, 01:10 PM
found it..

<%
response.buffer = true

'create a stream object
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")


objStream.Type = 1
objStream.Open
objStream.LoadFromFile "F:\Inetpub\UCI\test\image.jpg"
Response.ContentType = "image/JPEG"
Response.AddHeader "content-disposition", "inline;filename=image.jpg"
Response.BinaryWrite objStream.Read

'clean up..
objStream.Close
Set objStream = Nothing
%>