如何显示base64图像?URI太长了

b85*_*411 2 php base64 symfony

我有代码(下面)显示存储为base64的图像:

{% if question['image'] != '' %}
    <tr>
        <td colspan="4">
            <img src="{{ question['image'] }}" />
        </td>
    </tr>
{% endif %}
Run Code Online (Sandbox Code Playgroud)

但是,由于此错误,它不会加载:

Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个错误?

我更喜欢用PHP做一些事情(可能暂时存储图像并将其保存为服务器上的文件?)而不是更改Apache设置.

但任何想法都是受欢迎的.

b85*_*411 8

没关系,我只是意识到自己的错误.图像的URL必须是这样的:

src="data:image/jpeg;base64,{{ question['image'] }}"
Run Code Online (Sandbox Code Playgroud)

我之前没有data:image/jpeg;base64,.

希望这有助于其他人有一天有同样的问题!