Function API only Updated 17 Oct 2026
getProfilePictureUrl([user])
Returns the URL of a user's profile picture (a 164 × 164 thumbnail), for use in an img tag.
Parameters
userstringoptionalEmail of the user. Defaults to the logged-in visitor.
Returns
The URL of the profile picture. With a user given, the URL is built for that email without checking that the user exists. Without one, the logged-in visitor is used on a site with login; on a site without login the result is null.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
// #/API/profile-picture.js — return the current user's profile picture URL
export default () => {
if (!request.Jwt) {
return docly.denyAccess();
}
return {
url: docly.getProfilePictureUrl(request.Jwt.username)
};
}
// On a hash page, fetch the URL and set the <img src> from JavaScript —
// never call docly.getProfilePictureUrl(request.Jwt.x) directly in a hash
// template, since the rendered output is cached and would leak the first
// user's picture to every other user.
//
// <img id="avatar" alt="Profile">
// <script>
// fetch('/API/profile-picture')
// .then(r => r.json())
// .then(d => document.getElementById('avatar').src = d.url);
// </script>