Add function to check for image type.

Some servers do not have exif_imagetype available. So I added a work around.
Added test case for image type detection

Conflicts:
	changelog.txt