【问题标题】:image src not reading base64 string in razor view图像 src 未在剃刀视图中读取 base64 字符串
【发布时间】:2020-07-22 05:32:11
【问题描述】:
<div style="height:180px;">
        <table id="tblheader" style="border:none 0px black;width:100%;background:none;">
            <tbody>
                <tr>
                    @{
                         foreach (var ImageDataInfo in Model.JobImages.ImageDataInfo)
                         {
                            <td style="border-bottom: 1px solid #000000;">
                                <img src="@ImageDataInfo.ImageData" 
                                style="width:100px;height:100px;align-content:center;" />
                            </td>
                         }
                     }
                </tr>
            </tbody>
        </table>
    </div>

ImageDataInfo.ImageData 是一个 base64 字符串。图像未加载。请帮忙。

【问题讨论】:

标签: html asp.net razor base64


【解决方案1】:

试试这个:

<img src="data:image;base64,@System.Convert.ToBase64String(ImageDataInfo.ImageData)" style="width:100px;height:100px;align-content:center;" />

【讨论】:

    猜你喜欢
    • 2021-07-28
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多