Further fixing issue #315 for splice method

Moved the update image container code to live in a function and call it
when media is manipulated using splice/push methods.