Use php image_type_to_mime_type function to detect Content-Type