// example.php script checking authentication before rendering if (!user_is_logged_in()) header('HTTP/1.0 403 Forbidden'); exit; header('Content-Type: image/jpeg'); readfile('/var/www/private_images/user_photo.jpg'); Use code with caution. 3. Use Signed URLs for Cloud Storage