Symfony 在snappy生成的pdf文件中显示图像
我想将图像添加到snappy生成的pdf中,但没有显示任何内容 在我的小树枝上: 我正在数据库中保存文件名survey.event.image包含图像名Symfony 在snappy生成的pdf文件中显示图像,symfony,twig,snappy,Symfony,Twig,Snappy,我想将图像添加到snappy生成的pdf中,但没有显示任何内容 在我的小树枝上: 我正在数据库中保存文件名survey.event.image包含图像名 <div style="margin-top: 26px; width: 200px"> <img src="{{ asset('uploads/imagesFile/'~survey.event.image) }}" id="imgEvent"> </div> 可能图像路径错误,请尝试以下
<div style="margin-top: 26px; width: 200px">
<img src="{{ asset('uploads/imagesFile/'~survey.event.image) }}" id="imgEvent">
</div>
可能图像路径错误,请尝试以下操作:
<div style="width: 200px; height: auto;">
<img src="{{ pathToWeb }}/uploads/imagesFile/image.jpg" alt="img">
</div>
尝试使用
绝对url
获取绝对资源url
<div style="margin-top: 26px; width: 200px">
<img src="{{ absolute_url(asset('uploads/imagesFile/'~survey.event.image)) }}" id="imgEvent">
使用绝对值=true作为图像路径
<img src="{{ asset('uploads/imagesFile/'~survey.event.image, , absolute=true) }}" id="imgEvent">
OP正在使用asset函数来确定位置是的,但是为什么OP应该从asset
切换到一个绝对路径呢。没有意义当我使用资产
时,创建pdf时找不到图像。使用绝对路径不是更好的解决方案,但在这种情况下,我找不到更好的未定义函数
<div style="margin-top: 26px; width: 200px">
<img src="{{ absolute_url(asset('uploads/imagesFile/'~survey.event.image)) }}" id="imgEvent">
<img src="{{ asset('uploads/imagesFile/'~survey.event.image, , absolute=true) }}" id="imgEvent">