Neilo, the images are written to the page using a recordset. The recordset is set to order by the display_order column:
WHERE gallery_id = ' . $gallery_id . "
ORDER BY display_order ASC"
When you move images around in the admin section, it reorders the values in display_order column to effect the order in which they are output.