use dir instead of imgdata