adding pages function, able to attach images