【发布时间】:2020-09-16 00:57:08
【问题描述】:
我正在练习使用 node js 从数据库中上传和获取图像。上传部分进行得很顺利,但是获取部分出现了一些问题,获取图片的代码是app.get('/images', async (req, res) => { const img = await image(image is the model with type of buffer).find({}); res.render('image', { img }) }。 ejs 模板部分是<% img.forEach(i => { <img src="data:img/png;base64,<%= i.avatar(avatar is property on the image model) %>"> }。
有人能告诉我怎么做吗??
【问题讨论】: