Hello,
I wanted to show image of user in datagrid, however Image::createLink method returns path without the $basePath variable.
public function columnName(User $user): Html
{
$presenter = $this->getPresenter();
$basePath = $presenter->getHttpRequest()->getUrl()->getBasePath();
// Avatar
$image = $this->imageStorage->fromIdentifier($user->getImage());
$avatar = Html::el('img class="img-fluid img-circle mr-2" width="24px" alt="'.$user.'"')
->setSrc($basePath.$image->createLink());
// Link
$link = $presenter->lazyLink('User:edit', $user->getId());
$name = Html::el('a')->setHref($link)->addHtml($avatar)
->addText($user->getName());
return $name;
}
Hello,
I wanted to show image of user in datagrid, however
Image::createLinkmethod returns path without the$basePathvariable.