There are a couple of irritating things about having thousands of files in a single folder.
1) If you try to list the contents of the folder using dreamweaver or an FTP client or something it can be slow and the huge result listing can be a pain.
2) What happens when two different users both have a file named "me.jpg". You have to be careful to avoid name collisions.
The many directory approach helps with both of those problems. But then you may have the issue of having thousands of user directories.
Whether or not the /userId/photos approach is secure will depend on what your code looks like. You should NOT take the value of 'userId' directly from user input without first checking it or validating it to make sure it is safe. Someone could put in something like "../../passwd" or something and overwrite your password file.
If you are pulling an ID out of your database for the value of userId then you should make sure that whatever goes into the database is OK. If you can be absolutely sure that userId is an integer, then it sounds really safe to me.