The problem with that code is that it blindly assumes that a file named "whatever.jpg" is an image, and that the filename only has one dot...
Rule number 1: Users are malicious
Rule number 2: If not malicious, then clueless

IMO, checking out the results of getimagesize() alone is enough to determine if a file was an image. I could probably just have the code return if the "image" has no size.