If someone tries to use a template that has an image/logo for decoration other than the attachment one, this could cause badness. newImg could end up having length > 1.

Is there a better way to select the one you want?