That's right, I said Boba Fett.
Can someome point me to a tutorial, or perhaps aid me on how to make a banner, using CGI scripts, that randomly chooses from a group of images and displays one? I believe someone did this on the b3ta board, and every time I refreshed the image was different.
Oh, and yes, you ARE my CGI scripting bitches.
(,
Thu 26 Jun 2003, 1:49,
archived)
Can someome point me to a tutorial, or perhaps aid me on how to make a banner, using CGI scripts, that randomly chooses from a group of images and displays one? I believe someone did this on the b3ta board, and every time I refreshed the image was different.
Oh, and yes, you ARE my CGI scripting bitches.
' 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)
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
"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)
<img src="http://www.myserver.com/random.asp">
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)
Scary, but true.
I shat myself (luckily I was wearing wellies so nothing went on the carpet)
and more to the point...how would one tell porkies?
(,
Thu 26 Jun 2003, 2:00,
archived)
and while I hope you find the help you need
Cock OFF
I mean this in a nice way
(,
Thu 26 Jun 2003, 1:50,
archived)
Cock OFF
I mean this in a nice way
Fuck all about CGI so fuckoff
Sorry im apissed off nightworker and your wasting b3ta
(,
Thu 26 Jun 2003, 1:51,
archived)
Sorry im apissed off nightworker and your wasting b3ta