Improve detecting for image type and content-type, and add limit to number of tries getting a good image
Improve detecting for image type and content-type, and add limit to number of tries getting a good image

camd67/moebot,camd67/moebot