Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB7
Expertise: beginner
Apr 21, 2003

IsImageFile - Returns whether the file is an image

' Returns a boolean indicating whether the file is an image
Function IsImageFile(ByVal filePath As String) As Boolean
    ' add more extensions if you wish
    Dim extensions() As String = New String() {".bmp", ".jpg", ".jpeg", ".gif", _
        ".tif", ".tiff", ".png", ".tga", ".emf", ".wmf", ".bid"}
    ' return true if the extension of the specified file is contained in the 
    ' array above
    Return (Array.IndexOf(extensions, New System.IO.FileInfo(filePath) _
        .Extension) > -1)
End Function
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap