create intermediate directory before save image file