Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Character portraits in sheet (Cool thing I did, and minor request for help)

1635875588
Alan S.
Pro
Sheet Author
Since a recent update, it's now possible to use the character portrait in a sheet.&nbsp; I've done so in my newest sheet, seen here: &lt;div class="gridpicturebox"&gt; &lt;input class="blankit picturecheckbox" type="checkbox" id="picture" name="attr_pic-check" checked&gt; &lt;label class="picturelabel" for="picture"&gt; &lt;img class="portraitpicture" name="attr_character_avatar" alt="" height="134" width="134"&gt; &lt;/label&gt; &lt;/div&gt; .gridpicturebox{ grid-row-end: span 4; } .blankit { display: none; } .picturelabel{ padding-right: 0px; } .portraitpicture{ border: 5px double #333; height: 134px; max-width: initial; width: auto; background-image: url(<a href="https://i.imgur.com/LMoVHDf.jpg" rel="nofollow">https://i.imgur.com/LMoVHDf.jpg</a>); background-position: center; background-clip: content-box; background-size: cover; } .picturecheckbox:checked + .picturelabel { filter: sepia(1); } I'm pretty happy how this turned out.&nbsp; The portrait is a pseudo check-box, and checking it will toggle a sepia filter on and off.&nbsp; The image has a fixed height, and the width is set to auto to maintain the aspect ratio.&nbsp; I've got a background image that will appear if the character sheet doesn't have a portrait image.&nbsp; It was a little bit of a struggle figure out how to make that background display correctly, but the trick seems to be just hard-coding the dimensions into the html.&nbsp; The width: auto; &nbsp;in the css will overwrite the html width to maintain the portrait's aspect ratio, but if there is no portrait, it will default to the html value. The one wrinkle is that the edge of the background image seems to be poking out, ever so slightly, behind the character portrait.&nbsp; This seems to happen inconsistently based on the size of the portrait image and the zoom level.&nbsp; If anyone has ideas about what's causing that or how to fix it, I'm all ears.
1635876880

Edited 1635961555
vÍnce
Pro
Sheet Author
lol. Very timely Alan. I was just thinking of doing that on another sheet last night. Maybe you can use overflow:hidden or clip and just make sure the image is wider than the wrapping element... also, I was able to grab the sheet's avatar without having to supply an image url by using name="attr_sheet_avatar". EDIT: actually should be name="attr_character_avatar". &lt;span class="sheet-image-avatar"&gt; &lt;img alt="Avatar" name="attr_character_avatar"&gt; &lt;/span&gt; .sheet-image-avatar { align-items: center; background-color: transparent; display: inline-flex; height: 170px; justify-content: center; overflow: hidden; width: auto; } .sheet-image-avatar img { background-color: transparent; max-height: 170px; overflow: hidden; } Just a basic mock up and nearly as cool as your example. Cheers EDIT/UPDATE: not sure why, but although attr_sheet_avatar works on the Dev, it should be attr_character_avatar on the Main servers... I've updated my code accordingly.