hello experts

im making an upload script where users upload images. Images are stored in a single directory.
I want to know, if there are large number of images in one directory, does it cause images to load slow? is it better idea to store large number of images (eg. 20,000) in One directory, or i should create different directories?
How can i make any condition to create new directory automatically? eg. if there are 1000 images in one directory then it should create new one.
okay, if this can be done, then there is a problem in accessing images. for example, when displaying image, how can i know the new image path? (eg. how can i know that in which directory the image is located.
please let me know about any ideas.
thanks