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

Swift_Image->embed('imagePath'); #19

Open
TroodoNmike opened this issue Nov 11, 2016 · 1 comment
Open

Swift_Image->embed('imagePath'); #19

TroodoNmike opened this issue Nov 11, 2016 · 1 comment

Comments

@TroodoNmike
Copy link

TroodoNmike commented Nov 11, 2016

I am wondering if anyone have come across embedding images into twig using this bundle.

At the moment this doesnt work:
<img src="{{ asset('bundles/devtools/images/background.jpg') }}">

But this works:
Controller:
$img1 = $message->embed(\Swift_Image::fromPath('/path/DevToolsBundle/Resources/public/images/background.jpg'));

Twig:
<img src="{{ img1 }}">

Is there any better approach for that?

@GenieTim
Copy link

You should be able to use:

<img src="{{ absolute_url(asset('bundles/devtools/images/background.jpg')) }}">

Although, if you are sending the e-Mails from Command Line, you have to adjust your configuration slightly: http://symfony.com/doc/current/console/request_context.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants