Added image checking before serving image/jpeg content type.