There's this snippet I wrote for a guy a while back... on('ready',function(){
'use strict';
var getCleanImgsrc = function (imgsrc) {
var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)(.*)$/);
if(parts) {
return parts[1]+'thumb'+parts[3];
}
return;
};
on('chat:message',function(msg){
if('api' === msg.type && msg.content.match(/^!user-image/) && playerIsGM(msg.playerid) ){
let who=getObj('player',msg.playerid).get('_displayname'),
output = _.chain(msg.selected)
.map( s => getObj('graphic',s._id))
.reject(_.isUndefined)
.map( o => o.get('imgsrc') )
.map( getCleanImgsrc )
.reject(_.isUndefined)
.map(u => `<div><img src="${u}" style="max-width: 3em;max-height: 3em;border:1px solid #333; background-color: #999; border-radius: .2em;"><code>${u}</code></div>`)
.value()
.join('') || `<span style="color: #aa3333; font-weight:bold;">No selected tokens have images in a user library.</span>`
;
sendChat('UserImage',`/w "${who}" <div>${output}</div>`);
}
});
});
Select a bunch of things and run !user-image Original post: <a href="https://app.roll20.net/forum/permalink/4462334/" rel="nofollow">https://app.roll20.net/forum/permalink/4462334/</a>