Look for yourself that the add to cart's order in the code is AFTER your additional image code and through some code quirk it is where you want it and not due to the order.
I am only suggesting doing it right where you will then have some control versus relying on a "quirk" that gets upset when something else changes as you now have



