<%@ Language="VBScript" %> <% Response.ContentType = "application/json" Response.Buffer = True ' Slides folder path (local to IIS) Dim SLIDES_FOLDER SLIDES_FOLDER = Server.MapPath("slides") ' Valid image extensions Dim validExtensions validExtensions = Array("jpg", "jpeg", "png", "gif", "bmp", "webp") On Error Resume Next Dim fso, folder, file, slides, ext, i Set fso = Server.CreateObject("Scripting.FileSystemObject") ' Check if folder exists If Not fso.FolderExists(SLIDES_FOLDER) Then Response.Write("{""success"":false,""message"":""Slides folder not found""}") Set fso = Nothing Response.End End If Set folder = fso.GetFolder(SLIDES_FOLDER) ' Build array of image files Dim fileList() Dim fileCount fileCount = 0 For Each file In folder.Files ext = LCase(fso.GetExtensionName(file.Name)) ' Check if valid image extension For i = 0 To UBound(validExtensions) If ext = validExtensions(i) Then ReDim Preserve fileList(fileCount) fileList(fileCount) = file.Name fileCount = fileCount + 1 Exit For End If Next Next ' Sort files alphabetically (simple bubble sort) Dim j, temp If fileCount > 1 Then For i = 0 To fileCount - 2 For j = i + 1 To fileCount - 1 If fileList(i) > fileList(j) Then temp = fileList(i) fileList(i) = fileList(j) fileList(j) = temp End If Next Next End If ' Build JSON response Dim json json = "{""success"":true,""basepath"":""slides/"",""slides"":[" If fileCount > 0 Then For i = 0 To fileCount - 1 If i > 0 Then json = json & "," json = json & "{""filename"":""" & fileList(i) & """}" Next End If json = json & "]}" Response.Write(json) Set folder = Nothing Set fso = Nothing %>