add images to database as attachments