【发布时间】:2018-01-10 10:28:55
【问题描述】:
我有一个带有varbinary 类型图像的 SQL Server 数据库。我需要转换 varbinary 并将图像返回到网页。帮助将不胜感激。
我发现了这个,它很有帮助,但我需要反过来。 Node.js How to convert to image from varbinary of MS Sql server datatype
类似...
var image = new Buffer(rs.recordset[0].Image).toString('base64');
res.type('image/jpeg; charset=utf-8');
res.status(200).end(image);
<ng-template ngbSlide *ngFor="let image of images">
<img class="center-block" src="data:image/JPEG;base64,{{image}}">
</ng-template>
而我的服务是这样的……
getImage(query){
return this._http.get(this.API_URL + this.baseUrl + query)
.map(res => res.json());
}
【问题讨论】:
-
这个链接可以帮到你吗stackoverflow.com/questions/14667553/…
标签: node.js angular express node-mssql