I have an images dir at the root of my site. It includes images that should be public, in a public sub-directory, and images in a private directory that should only be available to logged in users. The problem is a logged-in user can copy the img URL, give it to a non-users and now they have access.
I have an .htaccess file set up already to prevent hotlinking. I suspect I need to create a controller that servers image, and checks user credentials b4 serving the image, and use .htaccess to send the user to that controller if they try to access private images? Is this best practice? Could someone please post some code to help me better visualize.