added logic to post images