def detect_format_from_location(location):
    """Try to detect the format from the given location and return None if it fails."""
    fmt = None
    location_lower = location.lower()
    known_formats = ['jpeg', 'jpg', 'png', 'gif', 'webp', 'svg', 'pdf', 'eps', 'ps']
    for candidate in known_formats:
        if location_lower.endswith(candidate):
            fmt = candidate
            break
    return fmt