如何显示base64图像? URI 太长

How to display base64 image? URI Too Long

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

{% if question['image'] != '' %}
    <tr>
        <td colspan="4">
            <img src="{{ question['image'] }}" />
        </td>
    </tr>
{% endif %}

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

Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.

如何解决这个错误?

我更愿意在 PHP 中做一些事情(也许临时存储图像并将其作为文件保存在服务器上?)而不是更改 Apache 设置。

但欢迎任何想法。

没关系,我刚刚意识到我的错误。图片的 URL 必须是这样的:

src="data:image/jpeg;base64,{{ question['image'] }}"

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

希望这对有一天遇到同样问题的其他人有所帮助!