YNOT
  • Home
  • Industry News
    • Adult Business News
    • Adult Novelty News
    • YNOT Magazine
    • EU News
    • Opinions
    • Picture Galleries
  • PR Wire
    • Adult Company News
    • Adult Retail News
    • Adult Talent News
    • Adult Videos News
  • Podcasts
  • Industry Guides
    • Adult Affiliate Guide
    • Affiliate Marketing for Beginners
    • Top Adult Traffic Networks
    • Top Adult PR Agents
    • Funding an Adult Business
  • Business Directory
    • View Categories
    • View Listings
    • Submit Listing
  • Newsletters
  • Industry Events
    • Events Calendar
    • YNOT Cam Awards | Hollywood
    • YNOT Awards | Prague
    • YNOT Cammunity
    • YNOT Summit
    • YNOT Reunion
  • Login with YNOT ID
YNOT University: Educational articles and tutorials

Coders Corner / ASP Thumbnail Galleries

Posted On 16 Oct 2000
By : admin

What do YOU think about this Script? Add YOUR comments at the end!

I’m very interested in running VBScript on my ASP pages. While I know most of you run some flavor of Unix, I prefer Microsoft Windows NT/2000 with IIS 4/5.What do YOU think about this Script? Add YOUR comments at the end!

I’m very interested in running VBScript on my ASP pages. While I know most of you run some flavor of Unix, I prefer Microsoft Windows NT/2000 with IIS 4/5. I’ve written all my ASP pages and scripts myself, including this cool VBScript that you can use to automate the creation of thumbnail galleries. The only thing you will have to do is create some thumbnail pictures and put them in a different directory than your “large” pictures. The script will find all pictures and create galleries for you. If you have new pictures, or additions to a certain gallery, just place the pictures in the directory, and you’re done!

How It Works
I’m using the File System Object (FSO) to open a the directory containing the files and list them all. (Function GetFiles) Second I create the HTML line for the thumb and link. (e.g. <a href=”\mypics\myfile.jpg” target=”_blank”><img src=”\mypics\thumbs\tn_myfile.jpg”></a>) All these links are put in an array. (Function CreatePictureArray) Then I calculate how many galleries are needed to display all thumbs. You do not want a gallery with 523 thumbs do you? So I check how many thumbs you want on one page, and so calculate the number of galleries needed. (Function HowManyTables).

The Sub DrawTable puts the table on the screen. It uses the gallerynumber to check what pictures to display. The DrawLinks Sub will create the |<, <, > and >| icons at the bottom. They can be used to navigate through the galleries. It uses the ?g= paramter in the URL to navigate. (e.g. http://mydomain.com/thumb4.asp?g=5 to see the 5th gallery) It would be quit nasty to have your webserver check the whole directory at every hit. Therefore stuff that you need on all pages (the PictureArray etc.) will be put in a Session variable the first time you access the page. This way it will be available to the user throughout the entire session. If you have a really loaded webserver with numerous hits/seconds you might consider using Application variables instead of the Session variables. Remember, if you do that and you add more pictures, you will have to restart the web application!

At the bottom you see the actual call to it all. If the ?g= is empty, this is the first time the script is run. Therefore it will scan your pictures directory and set the Session parameters in BuildSession. Otherwise it will just display the gallery the user wanted by using the DrawTable and DrawLinks Subs. Have fun!

There are a few easily understood parameters in the script that must be changed:

WebPath : Where does the WEB start physically on the drive
Picture Path: Where are the larger images relative to the WebPath
WebPicture Path : What’s the relative path to the pics in the Web
WebThumbPath: Where did ya hide the thumbs
ThumbPrefix: What is the prefic for thumbnail pics
TargetFrame: In what targetframe should the large images load
TableWidth: How many thumbs in a row
TableHeight: How may rows in a table
TotalTableWidth: Width (in pixels) of the table

Copy the script below, and save it in a text document as THUMBS4.ASP

”””””””””””””””””””””””””””””””””””””””””””””””””””
Function GetFiles (Path)
Dim fso, folder
Set fso = CreateObject (“Scripting.FileSystemObject”)
Set folder = fso.GetFolder (Path)
Set GetFiles = folder.Files
End Function

Function CreatePictureArray (FilesList, WebPicPath, WebThPath, ThPrefix, TarFrame)
Dim pcounter, returnarray ()
ReDim returnarray (FilesList.Count)
pcounter = 0
For Each File in FilesList
returnarray (pcounter) = “target='” & TarFrame & “‘>File.Name & “‘>”
Next
CreatePictureArray = returnarray
End Function

Function HowManyTables (FilesList, TbWidth, TbHeight)
Dim addition
If (FilesList.Count / (TbWidth * TbHeight)) Int (FilesList.Count / (TbWidth * TbHeight)) Then
Else
addition = 0
End If
HowManyTables = (Int (FilesList.Count / (TbWidth * TbHeight))) + addition
End Function

Sub DrawTable (TableNumber, PicArray, TbWidth, TbHeight, TotalWidth)
Dim currentpicture, rcounter, ccounter, width
width = TotalWidth / TbWidth
‘ Response.Write “”
Response.Write “”
If currentPicture > UBound (PicArray, 1) Then
‘ Nothing
Else
Response.Write “”
If currentpicture > UBound (PicArray, 1) Then
‘ Response.Write “.”
Response.Write “.”
Else
‘ Response.Write “” & PicArray (currentpicture) & “”
Response.Write “” & PicArray (currentpicture) & “”
‘ Response.Write “” & currentpicture & “”
End If
Next
Response.Write “”
End If
Next
Response.Write “”
Response.Write “”
End Sub

Sub DrawLinks (TableNumber, TotalTables)
Response.Write “”
Response.Write “|<”
Response.Write ” ”
Response.Write “”‘><”
Response.Write ” ”
Else
Response.Write “|<”
Response.Write ” ”
Response.Write “<”
Response.Write ” ”
End If
If Int(TableNumber) < TotalTables Then
Response.Write “”‘>>”
Response.Write ” ”
Response.Write “>|”
Response.Write ” ”
Else
Response.Write “>”
Response.Write ” ”
Response.Write “>|”
Response.Write ” ”
End If
Response.Write “”
End Sub

Sub BuildSession
Dim WebPath, PicturePath, WebPicturePath, WebThumbPath, ThumbPrefix,
TargetFrame, TableWidth, TableHeight, TotalTableWidth
WebPath = “C:\InetPub\WWWRoot\PornStartsHere\”
PicturePath = “Pics\Hardcore\”
WebPicturePath = “Pics/Hardcore/”
WebThumbPath = “Pics/Hardcore/Thumbs/”
ThumbPrefix = “tn_”
TargetFrame = “_blank”
TableWidth = 4
TableHeight = 5
TotalTableWidth = 400
Set Session(“files”) = GetFiles (WebPath & PicturePath)
Session (“PictureArray”) = CreatePictureArray (Session (“files”),
WebPicturePath, WebThumbPath, ThumbPrefix, TargetFrame)
Session (“TableWidth”) = TableWidth
Session (“TableHeight”) = TableHeight
Session (“TotalTableWidth”) = TotalTableWidth
Session (“tables”) = HowManyTables (Session (“files”), TableWidth,
TableHeight)
‘ Response.Write “——- Building Session ——-”
‘ Response.Write “Session Files: ” & Session (“files”).Count & “”
‘ Response.Write “Picture Array: ” & UBound (Session (“PictureArray”), 1) &
“”
‘ Response.Write “Tables: ” & Session (“tables”) & “”
‘ Response.Write “——– Session Built ———“
End Sub
”””””””””””””””””””””””””””””””””””””””””””””””””””
Dim gallery
If Request(“g”) = “” Then
BuildSession
Else
gallery = Request (“g”)
End if
‘Response.Write “——– Session Variables ——”
‘Response.Write “Session Picture Array: ” & UBound (Session
(“PictureArray”), 1) & “”
‘Response.Write “Session TableWidth: ” & Session (“TableWidth”) & “”
‘Response.Write “Session TableHeight: ” & Session (“TableHeight”) & “”
‘Response.Write “Session Tables: ” & Session (“tables”) & “”
‘Response.Write “———————————”
‘Response.Write “You want gallery ” & gallery & “”

Response.Write “Table ” & gallery & “”
DrawTable gallery, Session (“PictureArray”), Session (“TableWidth”), Session
(“TableHeight”), Session (“TotalTableWidth”)
DrawLinks gallery, Session (“tables”)
Response.Write “”
”””””””””””””””””””””””””””””””””””””””””””””””””””
%>

[ MORE SCRIPTS | CODER’S CORNER >>

Reader Comments on this Article:

Comment by:Summary:
StephenGreat to see some NT/ASP stuff
hgjjh
PsylockeTried the script, but it does nothi…

  • google-share
Previous Story

Protecting Yourself From Rip-Off Companies

Next Story

NT or UNIX Hosting?

Leave a Reply Cancel reply

You must be logged in to post a comment.

Sponsor

YNOT Shoot Me

YNOTShootMe.com has exclusive pics from adult industry business events. Check it out!

YNOT Directory

  • WMA
    News & Resources
  • Christie’s Sales
    Novelty & Lingerie Distributors
  • Orchid Designs
    Web Design & Templates
  • Premiere Listing

    Clickadu – Your trusted traffic souce

    More Details

RECENT

POPULAR

COMMENTS

Jasmine Sherni Guests on Holly Randall Unfiltered

Posted On 29 Aug 2025
Motorbunny Announces “Date Night Challenge” Sweepstakes

Motorbunny Announces “Date Night Challenge” Sweepstakes

Posted On 29 Aug 2025
Grooby Drops “Black-TGirls Jizz Jam #26”

Grooby Drops “Black-TGirls Jizz Jam #26”

Posted On 29 Aug 2025

Vanessa, Meet Vivid

Posted On 29 Sep 2014
Laila Mickelwaite and Exodus Cry

Laila Mickelwaite, Exodus Cry and their Crusade Against Porn

Posted On 03 May 2021

Someone puts Gal Gadot in one of your vids? Take it down!

Posted On 13 Dec 2017

Hoping viewers can also enjoy a spooky...

Posted On 24 Oct 2023

now a days these type of games will get...

Posted On 17 Jul 2023

good move from adent. these type of...

Posted On 06 Jul 2023

Sponsor

Sitemap
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkPrivacy Policy