Creating a custom Walker is a valid way to solve this, and is the first thing that crossed my mind, but it is not strictly necessary. It is possible to pull this off with filters, albeit by mildly abusing one of them 🙂
Proof of concept:
function insert_image_wpse_130477($item_output) {
remove_filter('walker_nav_menu_start_el','insert_image_wpse_130477');
$prepend = apply_filters('my_item_prepend','');
return $prepend.$item_output;
}
function check_id_wpse_130477($id, $item, $args) {
if ('menu-item-6' == $id) { // edit for your circumstances
add_filter(
'my_item_prepend',
function() use ($id) {
// add logic to conditionally add your images based on the ID
return '##'.$id.'##';
}
);
add_filter(
'walker_nav_menu_start_el',
'insert_image_wpse_130477'
);
}
return $id;
}
add_filter('nav_menu_item_id','check_id_wpse_130477',1,3);
I can think of several other ways to do this– a class, for example, or a single more complicated callback and a static variable– but this is probably the easiest to follow.