Click here to Skip to main content
15,883,558 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to add thumbnails on all pages and old archive on this script


To look like
epaper.deccanchronicle.com

epaper.greaterkashmir.com

epaper.kashmirreporter.com




Code is here full





<%@LANGUAGE="VBSCRIPT"%><%

PageTitle = "ASP AutoGallery Version 3.0 (Default Install)"
BackgroundColor = "#0f0f0f"
HyperlinkColor = "#ffffff"
FontFace = "Verdana"
FontColor = "#c0c0c0"
TextAlign = "Justified"
HeaderAlign = "Center"
FolderPath = "/AutoGallery/" 'Path must be mapped from root
PageWidth = "800"
BorderWidth = "1"
BorderColor = "#ffffff"
BorderMargin = "10"
PageHeader = "ASP AutoGallery Version 3.0 (Default Install)"
PageMessage = "
Full documentation available here"
ImageHorizontalSpace = "10"
ImageVerticalSpace = "10"
ImageThumbnailWidth = "100"
ImageBorderSize = "1"
ImagesPerRow = "8"
UseFilenameALT = "YES"
ShowCopyright = "YES"
DebugPath = "YES"
TurnOnPaging = "YES"
ImagesPerPage = "1" 'Only relevant if paging is turned on
DisplayImageCountFooter = "YES"
TurnOnSlideshow = "NO"
SlideShowTimer = "5" 'Number of Seconds to pause between transitions in slideshow mode.
SlideShowImageWidth = "500"
GalleryAutoPreview = "YES"
GalleryPreviewZoomImageWidth = "300"
TurnOnThumbnailSupport = "NO" 'This does not create thumbnails. See documenation for full explination.
ThumbnailIdentifier = "_thumbnail" '(Example: "Image1_thumbnail.jpg" would be the thumbnail image file for "Image1.jpg")
UseGreyscaleMouseover = "YES" 'Note: Only works for Internet Explorer users
PersonalCopyrightTagline = "All imgages © copyright their respective owners."
UseNoRightClick = "YES" 'Note: Only works for Internet Explorer users
ViewImageWidth = "600"
UseViewImageDownload = "YES"
UseViewSendToFriend = "YES"
VeiwSendToFriendMessage = "Take a look at this image on the ASP AutoGallery Versioin 3.0 (Default Install):"
UseFilenameDescriptions = "YES"

'DO NOT EDIT BELOW THIS LINE ===============================================================================================================================













































































varMode = request.querystring("mode")

Whichfolder=server.mappath("" & FolderPath & "")
if lcase(TurnOnPaging) = "yes" then
Dim fs, f, f1, fc
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Whichfolder)
Set fc = f.files
For Each f1 in fc


if lcase(UseFilenameALT) = "yes" then
ImageAlt = f1.name
ImageAltLen = Len(ImageAlt)
ImageAltCrop = (int(ImageAltLen) - 4)
ImageAlt = Left(ImageAlt, ImageAltCrop)
end if


ImageFileFound = "No"
if right(f1.name, 4) = ".jpg" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".gif" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".png" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".bmp" then ImageFileFound = "Yes"



TN_IsThumbnailFlag = ""
if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_IdentifierLen = Len(ThumbnailIdentifier)
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_ThumbnailCheck = Right(TN_Filename, TN_IdentifierLen)
if TN_ThumbnailCheck = ThumbnailIdentifier then TN_IsThumbnailFlag = "True"
end if

if TN_IsThumbnailFlag = "" and ImageFileFound = "Yes" then
intImageCount = intImageCount + 1

end if
Next
end if




Whichfolder=server.mappath("" & FolderPath & "")
if lcase(TurnOnPaging) <> "yes" then
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Whichfolder)
Set fc = f.files
For Each f1 in fc
ImageFileFound = "No"
if right(f1.name, 4) = ".jpg" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".gif" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".png" then ImageFileFound = "Yes"
if right(f1.name, 5) = ".bmp" then ImageFileFound = "Yes"
if f1.name <> "index.asp" and ImageFileFound = "Yes" then
intImageCount = intImageCount + 1
end if
Next
end if



intTotalNumberOfImages = intImageCount


if varMode = "" then


intNumberOfPages = (intImageCount/ImagesPerPage)
if intNumberOfPages > int(intNumberOfPages) then intNumberOfPages = int(intNumberOfPages) + 1%><HTML><HEAD><TITLE><%=PageTitle%> [Gallery]</TITLE>


Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Value = DateTime.Now.ToString()
End Sub
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
if (document.images)
return true;
else
return false;
}

// loadPosterImage

function loadPosterImage(imageURL) {
if (gImageCapableBrowser) {
document.imagePoster.src = imageURL;
return false;
}
else {
return true;
}
}

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

// -->
</SCRIPT>


<% if lcase(UseGreyscaleMouseover) = "yes" then %>
<style type="text/css">a:link img {filter:none; } a:hover img{filter:gray}</style>
<% end if %>




<% if lcase(UseNoRightClick) = "yes" then %>
<script language="JavaScript"> <!--
var message="<% response.write(PersonalCopyrightTagline) %>";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {

return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> </script>

<% end if %>



</HEAD><BODY BGCOLOR="<%=BackgroundColor%>" LINK="<%=HyperlinkColor%>" ALINK="<%=HyperlinkColor%>" VLINK="<%=HyperlinkColor%>">
<% if lcase(DebugPath) = "yes" then %>

(Debug Path: <%=Whichfolder%>)


<% end if %>
<% if lcase(HeaderAlign) = "center" then %>
<% end if %><%=PageHeader%><% if PageHeader <> "" then %>

<% end if %><% if lcase(HeaderAlign) = "center" then %>

<% end if %>
<% if lcase(TextAlign) = "center" then %>
<% end if %><%=PageMessage%><% if PageMessage <> "" then %>

<% end if %><% if lcase(TextAlign) = "center" then %>

<% end if %>
<%
if TurnOnPaging = "YES" then
intCurrentPage = request.querystring("Page")
if intCurrentPage = "" then intCurrentPage = "1"
FirstImageAllowedOnPage = ((int(intCurrentPage) * int(ImagesPerPage)) - int(ImagesPerPage)) + 1
FinalImageAllowedOnPage = (int(intCurrentPage) * int(ImagesPerPage))
%>
Currently Viewing Page # <%=intCurrentPage%> of <%=intNumberOfPages%>
<< <% if int(intCurrentPage) > 1 then %><% end if %>Previous Page | <% if int(intCurrentPage) < (intNumberOfPages) then %><% end if %>Next Page >>


<% if lcase(TurnOnSlideshow) = "yes" then %>

Change to Slideshow Mode
<% end if %>








<%
end if %>



<% if lcase(TurnOnSlideshow) = "yes" and lcase(TurnOnPaging) = "no" then %>

Change to Slideshow Mode



<% end if %>


<%
PassCount = 1
intImageCount = 0
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Whichfolder)
Set fc = f.files
For Each f1 in fc

if lcase(UseFilenameALT) = "yes" then
ImageAlt = f1.name
ImageAltLen = Len(ImageAlt)
ImageAltCrop = (int(ImageAltLen) - 4)
ImageAlt = Left(ImageAlt, ImageAltCrop)
end if

ImageFileFound = "No"
if right(f1.name, 4) = ".jpg" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".gif" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".png" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".bmp" then ImageFileFound = "Yes"

if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_IdentifierLen = Len(ThumbnailIdentifier)
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_ThumbnailCheck = Right(TN_Filename, TN_IdentifierLen)
end if


if TN_ThumbnailCheck <> ThumbnailIdentifier and ImageFileFound = "Yes" then
intImageCount = intImageCount + 1
PassCount = PassCount + 1
if lcase(TurnOnPaging) = "yes" and int(intImageCount) > int(FirstImageAllowedOnPage)-1 then
if lcase(TurnOnPaging) = "yes" and int(intImageCount) < int(FinalImageAllowedOnPage)+1 then
if PassCount > ImagesPerRow + 2 then PassCount = ImagesPerRow -1
if PassCount = ImagesPerRow + 2 then %>
<% PassCount = 2 %><% end if%><%

if lcase(TurnOnPaging) = "yes" and varPosterDefault = "" then varPosterDefault = WichFolder & f1.name


if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_FileExtension = Right(f1.name, 4)
DisplayThumbnail = TN_Filename & ThumbnailIdentifier & TN_FileExtension
end if


if lcase(TurnOnThumbnailSupport) <> "yes" then
varPosterTranslation = Replace(f1.name, " ", "%20")
Response.write ("<IMG SRC='" & FolderPath & f1.name & "' BORDER='"& ImageBorderSize &"' WIDTH='" & ImageThumbnailWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT='Image #" & intImageCount & " of " & intTotalNumberOfImages &": " & ImageAlt & "' önMouseOver=return(loadPosterImage('" & FolderPath & varPosterTranslation & "'))>")
end if
if lcase(TurnOnThumbnailSupport) = "yes" then
varPosterTranslation = Replace(f1.name, " ", "%20")
Response.write ("<IMG SRC='" & FolderPath & DisplayThumbnail & "' BORDER='"& ImageBorderSize &"' WIDTH='" & ImageThumbnailWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT='Image #" & intImageCount & " of " & intTotalNumberOfImages &": " & ImageAlt & "' önMouseOver=return(loadPosterImage('" & FolderPath & varPosterTranslation & "'))>")
end if


end if
end if
if lcase(TurnOnPaging) <> "yes" then
if PassCount > ImagesPerRow + 2 then PassCount = ImagesPerRow -1
if PassCount = ImagesPerRow + 2 then %>
<% PassCount = 2 %><% end if%><%
if lcase(TurnOnPaging) <> "yes" and varPosterDefault = "" then varPosterDefault = WichFolder & f1.name



if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_FileExtension = Right(f1.name, 4)
DisplayThumbnail = TN_Filename & ThumbnailIdentifier & TN_FileExtension
end if


if lcase(TurnOnThumbnailSupport) <> "yes" then
Response.write ("<IMG SRC='" & FolderPath & f1.name & "' BORDER='"& ImageBorderSize &"' WIDTH='" & ImageThumbnailWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT='Image #" & intImageCount & " of " & intTotalNumberOfImages &": " & ImageAlt & "' önMouseOver=return(loadPosterImage('" & FolderPath & f1.name & "'))>")
end if
if lcase(TurnOnThumbnailSupport) = "yes" then
Response.write ("<IMG SRC='" & FolderPath & DisplayThumbnail & "' BORDER='"& ImageBorderSize &"' WIDTH='" & ImageThumbnailWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT='Image #" & intImageCount & " of " & intTotalNumberOfImages &": " & ImageAlt & "' önMouseOver=return(loadPosterImage('" & FolderPath & f1.name & "'))>")
end if


end if
end if
Next %><% if int(intTotalNumberOfImages) < 1 then %>

Sorry, but no image files were found in the current directory.

For the ASP AutoGallery to work you must first upload at least one image file (.JPG, .GIF or .PNG) into this directory:
<%=Whichfolder%>.








<% end if %><% if lcase(TurnOnPaging) = "yes" then %>
Select By Page: <%
DO UNTIL varPageParsing = int(intNumberOfPages)
varPageParsing = varPageParsing + 1 %><%=varPageParsing%> <% LOOP %>
<% end if %>


<% if lcase(GalleryAutoPreview) = "yes" then %>

<IMG NAME="imagePoster" WIDTH=<%=GalleryPreviewZoomImageWidth%> SRC="<%=varPosterDefault%>" ALT="Image Preview Zoom">


<% end if %>



<% if lcase(DisplayImageCountFooter) = "yes" then %>
<%=PageTitle%> has a total of <%=intTotalNumberOfImages%> images in the gallery.
<% end if %>











<% if lcase(PersonalCopyrightTagline) <> "" then %>
<%=PersonalCopyrightTagline%>
<% end if%>

<% if lcase(ShowCopyright) = "yes" then %>
ASP AutoGallery Version 3.0
Copyright © 2007. <% end if %>

<% if int(CurrentPic) = int(intTotalNumberOfImages) then %>
<meta http-equiv="Refresh" content="<%=SlideShowTimer%>;url=index.asp?mode=slideshow&CurrentPic=1">
<% end if %>


<% if lcase(UseNoRightClick) = "yes" then %>
<script language="JavaScript"> <!--
var message="<% response.write(PersonalCopyrightTagline) %>";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {

return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> </script>
<% end if %>





</HEAD><BODY BGCOLOR="<%=BackgroundColor%>" LINK="<%=HyperlinkColor%>" ALINK="<%=HyperlinkColor%>" VLINK="<%=HyperlinkColor%>">



<% if lcase(HeaderAlign) = "center" then %>
<% end if %><%=PageHeader%><% if PageHeader <> "" then %>

<% end if %><% if lcase(HeaderAlign) = "center" then %>

<% end if %>
<% if lcase(TextAlign) = "center" then %>
<% end if %><%=PageMessage%><% if PageMessage <> "" then %>

<% end if %><% if lcase(TextAlign) = "center" then %>

<% end if%>






<%

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Whichfolder)
Set fc = f.files
For Each f1 in fc

ImageAlt = f1.name
ImageAltLen = Len(ImageAlt)
ImageAltCrop = (int(ImageAltLen) - 4)
ImageAlt = Left(ImageAlt, ImageAltCrop)



ImageFileFound = "No"
if right(f1.name, 4) = ".jpg" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".gif" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".png" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".bmp" then ImageFileFound = "Yes"


if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_IdentifierLen = Len(ThumbnailIdentifier)
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_ThumbnailCheck = Right(TN_Filename, TN_IdentifierLen)
end if


if TN_ThumbnailCheck <> ThumbnailIdentifier and ImageFileFound = "Yes" then

PassCount = PassCount + 1
if int(PassCount) = int(CurrentPic) then
Response.write ("
<IMG SRC='" & FolderPath & f1.name & "' BORDER='"& ImageBorderSize &"' WIDTH='" & SlideShowImageWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT=''>")
%>


<% if lcase(UseFilenameDescriptions) = "yes" then %>

"<%=ImageAlt%>"

<% end if %>


(Currently viewing picture <%=CurrentPic%> of <%=intTotalNumberOfImages%>)


<% if CurrentPic > 1 then %>

<% end if %>
Previous Picture
|
<% if CurrentPic < intTotalNumberOfImages then %>

<% end if %>
Next Picture



Change to Gallery Mode



<%
end if
end if
Next

%>





















<% if lcase(PersonalCopyrightTagline) <> "" then %>
<%=PersonalCopyrightTagline%>
<% end if%>

<% if lcase(ShowCopyright) = "yes" then %>
ASP AutoGallery Version 3.0
Copyright © 2007.



<% if lcase(HeaderAlign) = "center" then %>
<% end if %><%=PageHeader%><% if PageHeader <> "" then %>

<% end if %><% if lcase(HeaderAlign) = "center" then %>

<% end if %>
<% if lcase(TextAlign) = "center" then %>
<% end if %><%=PageMessage%><% if PageMessage <> "" then %>

<% end if %><% if lcase(TextAlign) = "center" then %>

<% end if%>










<%

CurrentPic = request.querystring("Image")
ReturnPage = request.querystring("ReturnPage")
if CurrentPic = "" then CurrentPic = "1"
if ReturnPage = "" then ReturnPage = "1"

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Whichfolder)
Set fc = f.files
For Each f1 in fc

ImageAlt = f1.name
ImageAltLen = Len(ImageAlt)
ImageAltCrop = (int(ImageAltLen) - 4)
ImageAlt = Left(ImageAlt, ImageAltCrop)



ImageFileFound = "No"
if right(f1.name, 4) = ".jpg" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".gif" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".png" then ImageFileFound = "Yes"
if right(f1.name, 4) = ".bmp" then ImageFileFound = "Yes"


if lcase(TurnOnThumbnailSupport) = "yes" then
TN_OriginalFilename = Len(f1.name)
TN_FilenameLenWithoutExt = int(TN_OriginalFilename) - 4
TN_IdentifierLen = Len(ThumbnailIdentifier)
TN_Filename = Left(f1.name, TN_FilenameLenWithoutExt)
TN_ThumbnailCheck = Right(TN_Filename, TN_IdentifierLen)
end if


if TN_ThumbnailCheck <> ThumbnailIdentifier and ImageFileFound = "Yes" then

PassCount = PassCount + 1
if int(PassCount) = int(CurrentPic) then
Response.write ("<IMG SRC='" & FolderPath & f1.name & "' BORDER='"& ImageBorderSize &"' WIDTH='" & ViewImageWidth & "' VSPACE='" & ImageVerticalSpace & "' HSPACE='" & ImageHorizontalSpace & "' ALT=''>")
%>

<% if lcase(UseFilenameDescriptions) = "yes" then %>

"<%=ImageAlt%>"

<% end if %>


(Currently viewing picture <%=CurrentPic%> of <%=intTotalNumberOfImages%>)

Return to Gallery

<% if lcase(UseViewImageDownload) = "yes" then %>

<%
if left((right(f1.name, 5)), 2) <> ".." then
varPosterTranslation = Replace(f1.name, " ", "%20")
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.GetFile(Server.MapPath("/") & FolderPath & f1.name)
ImageFileSize = a.Size
ImageFileSize = int(int(ImageFileSize) * 0.0009765625)
DisplayKB = " ( " & ImageFileSize & "KB )"
end if
%>

| Download This Image<%=DisplayKB%>
<% end if %>

<% if lcase(UseViewSendToFriend) = "yes" then %>
<% SendURL = " http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME") & "?Mode=view%26Image=" & CurrentPic %>
<% VeiwSendToFriendMessage = VeiwSendToFriendMessage & vbCrLf & vbCrLf %>
| Send This Image To A Friend
<% end if %>







<%
end if
end if
Next

%>
































<% if lcase(PersonalCopyrightTagline) <> "" then %>
<%=PersonalCopyrightTagline%>
<% end if%>

<% if lcase(ShowCopyright) = "yes" then %>
ASP AutoGallery Version 3.0
Copyright © 2007.









Posted
Updated 28-May-14 19:02pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900