You are not logged in. Login or Signup
Home » Messageboard » XXX » Message 1461656 (Thread)

# I did one...
pretty dull really.
(, Thu 26 Jun 2003, 1:50, archived)
# but in asp,
not cgi.. (whats the difference?)
(, Thu 26 Jun 2003, 1:50, archived)
# No idea...maybe it was asp
Could you show me how?
(, Thu 26 Jun 2003, 1:51, archived)
#
' random image displayer
function getBinaryFile(fileSpec)
Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

Const ForReading = 1
Const TristateFalse = 0
imagepath = "whatever\folder\yer\images\are\in"

path = server.mappath(imagepath)
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(path)
Set filez = folder.Files
FileCount = folder.Files.Count

randomize
RndImgNum = int(rnd() * FileCount)

x = 0

For Each image in filez
if x = RndImgNum then
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFile(path & "\" & image.name)
Set objTS = objFile.OpenAsTextStream(ForReading, TristateFalse)
ImageFile = objTS.readall
if instr(image.name, ".gif") > 0 then
response.contenttype = "image/gif"
response.binarywrite getBinaryFile(path & "\" & image.name)
else
response.contenttype = "image/jpeg"
response.binarywrite getBinaryFile(path & "\" & image.name)
end if

end if
x = x + 1
Next
(, Thu 26 Jun 2003, 1:53, archived)
# Weee
fanks
(, Thu 26 Jun 2003, 1:54, archived)
# so say you call that ASP file
"random.asp" then all you do to get the pic is
<img src="http://www.myserver.com/random.asp">
(, Thu 26 Jun 2003, 1:56, archived)
# Im sorry
Who killed who, and did Shelia have the baby?
(, Thu 26 Jun 2003, 1:55, archived)
# Him killed Who,
Shiela ate the baby and Bruce married the goat.
(, Thu 26 Jun 2003, 1:57, archived)
# No!
(, Thu 26 Jun 2003, 1:58, archived)
# YES!
Tis fucking true..

Scary, but true.

I shat myself (luckily I was wearing wellies so nothing went on the carpet)
(, Thu 26 Jun 2003, 1:59, archived)
# are you telling porkies again?
and more to the point...how would one tell porkies?
(, Thu 26 Jun 2003, 2:00, archived)
# With a
Porkipine? Damn I wish I was near my photoshop :(
(, Thu 26 Jun 2003, 2:02, archived)
# Was your
Piss bag full again?
(, Thu 26 Jun 2003, 2:00, archived)