gpt4 book ai didi

php - 如何显示base64图像? URI 太长

转载 作者:行者123 更新时间:2023-12-02 06:56:08 25 4
gpt4 key购买 nike

我有代码(如下)来显示存储为 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,前。

希望这可以帮助其他人有一天如何遇到同样的问题!

关于php - 如何显示base64图像? URI 太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31041221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com