get image dir function