Use getimagesize as fallback
Added test for binary file
add unit test on mimeType