You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
520 B
JavaScript
16 lines
520 B
JavaScript
"use strict";
|
|
|
|
const { validateOptions, required, isNumber, isString } = require("validatem");
|
|
const isMXC = require("./validate/is-mxc");
|
|
|
|
module.exports = function generateThumbnailUrl({homeserver, mxc, width, height }) {
|
|
validateOptions(arguments, {
|
|
homeserver: [ required, isString ],
|
|
mxc: [ required, isMXC ],
|
|
width: [ required, isNumber ],
|
|
height: [ required, isNumber ]
|
|
});
|
|
|
|
return `${homeserver}/_matrix/media/v1/thumbnail/${mxc.homeserver}/${mxc.id}?width=${width}&height=${height}&method=scale`;
|
|
};
|