Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image::createLink doesn't return link with $basePath #23

Open
juniwalk opened this issue Jun 25, 2020 · 0 comments
Open

Image::createLink doesn't return link with $basePath #23

juniwalk opened this issue Jun 25, 2020 · 0 comments

Comments

@juniwalk
Copy link

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant