IsThere1_Image

Searches for an image and return the file extension of found, or returns null if not found, searches for jpg, jpeg, png, and gif types of images
Pass image file name without extension and get the extension if that image was found

CodeFunctionName
What is this?

Public

Tested

Original Work
Function IsThere1_Image(ImagePath_MapPathed_NoExt, ImagePath_UnMapPathed_NoExt)
' Needs IsThere1_Folder
' Returns blank if not found, or file extension for file if found
IsThere1_Image = ""
If IsThere1_Folder(ImagePath_MapPathed_NoExt, ImagePath_UnMapPathed_NoExt) Then
FilePath = ""
If ImagePath_MapPathed_NoExt > "" And ImagePath_UnMapPathed_NoExt = "" Then
FilePath = ImagePath_MapPathed_NoExt
ElseIf ImagePath_MapPathed_NoExt = "" And ImagePath_UnMapPathed_NoExt > "" Then
FilePath = Server.MapPath(ImagePath_UnMapPathed_NoExt)
End If
If FilePath = "" Then Exit Function
Rett = ""
Rett = fso.FileExists(FilePath & ".jpg")
If Rett Then
IsThere1_Image = ".jpg"
Else
Rett = fso.FileExists(FilePath & ".jpeg")
If Rett Then
IsThere1_Image = ".jpeg"
Else
Rett = fso.FileExists(FilePath & ".png")
If Rett Then
IsThere1_Image = ".png"
Else
Rett = fso.FileExists(FilePath & ".gif")
If Rett Then IsThere1_Image = ".gif"
End If
End If
End If
End If
End Function

ImagePath_MapPathed_NoExt, ImagePath_UnMapPathed_NoExt
One of them

Views 1,308

Downloads 456

CodeID
DB ID