Update GD.php

getimagesize() will fail if the file has 0 length and will pop notice. Moreover, file_exists() will return true if it's directory so it's good to do check with is_file() function. 

Second change is to use pathinfo() function to get extension of file. The best idea would be to check mime type of file with.
Shouldn't this be greater than 0, not 1?