1. To do everything in the template. Just instead of $thumb and $popup print $images['thumb'] and $images['popup']
2. Controller replace product pictures for $data['thumb'] and $data['popup'] on the first of the additional pictures.
In both cases, don't forget to remove the first image additional image to output additional images