Okay I've figured out that the .htaccess solution
is preventing hotlinking, however when someone hotlinks to a gallery image it shows up as a broken image link, and if the person then right clicks on the image and chooses "view image"
then they can see it.
So the .htaccess method is a good solution for preventing hotlinking, but not useful to prevent people from sharing images altogether. But then again, there is nothing to stop anyone from just copying the images and uploading them somewhere else either, so it's probably not a big deal.
Sorry to waste your time.