check for valid image types

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
skyros
Posts: 1
Joined: October 9th, 2009, 11:49 am

Hi everyone,
Ijust finished a script here at work and am setting up some error handling when I ran into a snag. Im trying to find out if there is an easy way to check that a list of files are valid images? Right now, if someone tries to import a text file the script stops working but no error is given.

Suggestions?
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

One way is to check the extension against an array of know image extensions. I would say that would take care of 99% of the cases. Otherwise on mac you could check the file type but I would proably just trust the extension.

-Lloyd
Post Reply