2018-11-09 22:09:28 -05:00
|
|
|
/**
|
|
|
|
* @user-thumbnail
|
|
|
|
* Utility functions to return thumnail-related strings
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a thumbnail url for a particular userid, with width and height.
|
|
|
|
* @param {string} userId userId for the user whose thumbnail we want
|
|
|
|
* @param {number} width desired thumbnail width; defaults to 32
|
|
|
|
* @param {number} height desired thumbnail height; defaults to width.
|
|
|
|
* @returns {string} thumbnail url string
|
|
|
|
*/
|
|
|
|
const thumbnailUrl = (userId, width, height) => (
|
2018-11-21 10:07:57 -05:00
|
|
|
`${process.env.STATIC_HOST}/get_image/user/${userId}_` +
|
2018-11-13 15:07:51 -05:00
|
|
|
`${width ? width : 32}x${height ? height : (width ? width : 32)}.png`
|
2018-11-09 22:09:28 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
module.exports = thumbnailUrl;
|