我做了以下事情:
img_path = 'abc.jpg'
<img src="{{ img_path | imagine_filter(filter) }}">
所以我希望网址为https
。目前我正在使用http
获取网址。
我在参数中设置了router.request_context.scheme: https
。但是没有用。
所以实际上我想设置vendor/symfony/symfony/src/Symfony/Component/Routing/RequestContext.php
scheme
属性https
。
答案 0 :(得分:0)
设置用于将来请求的HTTP主机。您必须在发出任何HTTP请求之前调用此方法。 host是主机的名称,可选择使用端口(例如“google.com”或“localhost:5984”)方案来使用协议方案。有效值为“http”,“https”
答案 1 :(得分:0)
我更改了liip / imag-bundle / Imagine / Cache / Resolver / WebPathResolver.php,因为我遇到了同样的问题。
在第151行,我添加了 $ this-&gt; requestContext-&gt; setScheme('https'); :
$baseUrl = rtrim($baseUrl, '/\\');
$this->requestContext->setScheme('https');
return sprintf('%s://%s%s%s',
$this->requestContext->getScheme(),
$this->requestContext->getHost(),
$port,
$baseUrl
);
但在我的情况下,项目的老开发人员完全改变了这个框架,我永远无法更新它