Implemented another way of getting image directory