Hi there,
I need to display profile pics into circles. Pretty classic and could be made with mask-image with Tailwind.
It should look like :
<div class="mask-radial-at-center mask-radial-from-100% bg-[url(/img/mountains.jpg)] ..."></div>
So here’s my code
<!-- event speaker and moderator (if any) !-->
<?php $speakers = $event->speakers()->toStructure();?>
<?php if ($speakers->isnotempty()):?>
<div class="flex flex-row gap-1">
<?php foreach ($speakers as $speaker):?>
<?php if($speaker->speakerPortrait()->toFile()):?>
<div class="mask-radial-at-center mask-radial-from-100% h-10 bg-[url(<?= $speaker->speakerPortrait()->toFile()->crop(200)->url()?>)]">
</div>
<?php endif ?>
<?php endforeach ?>
</div>
<?php endif ?>
The issue I have is that when Tailwind is compiled, it doesn’t see any value into bg-[url(?= …?>)] and so this isn’t compiled hence no image is shown.
So far when I was using this kind of bg, I was putting my images in a src folder to bypass this but for this case I can’t go that way.
I could try to use <img> instead and then add on top another div with the cercle, basically trying to recreate a mask..
Has anyone find out a solution to use Tailwind with dynamic images as background for div ?
Thanks for your help!