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.
It could be but have you seen image that has 1 byte?