Users of the website need to able to store images in their "area" , should I store these in the database directly or create a directory for each user. Or should I just have a single directory for all images and in the database store a list of images that each user owns? I'm looking for the most effecient way, which I think is a folder for each user?
If you have many pictures per user like avatar and gallery of photo created by the user then use separate folders named with the user id or a hash of the user id.
If you only store avatars have one big folder where the name of the image is the user id or hash of the user id.
It depends on how many pictures there are.
If there is only one picture per user, then perhaps all in the same directory.
However if you have albums and such, there can be millions of photos with all the users photos in the same folder. This would be very slow to search in. Then I'd go with one folder per user.
Also, never give direct access to the folders. Use your database to link to the files.
Better use folder or a cache folder. You can also use resizing functions for the image, so if user upload a large scale picture. Your script will manage to create different sizes, like avatar pics. And cache those images. So thumbnail or avatar viewers only viewing the cache image of the original image. And the large image is usable for future work, like a bigger preview of the avatar.