Je télécharge une image vers ./public/images via multer ... Elle est très bien chargée et je peux la voir dans le dossier ainsi que dans la base de données associée. et tout ..Récupération et affichage de l'image téléchargée via multer
Voici l'itinéraire de poste:
exports.postRevive = (req, res, next) => {
var reviveShowName = req.body.reviveShowName;
var reviveGoal = req.body.reviveGoal;
var reviveTitle = req.body.reviveTitle;
var reviveVideo = req.body.reviveVideo;
var reviveStory = req.body.reviveStory;
var reviveCategory = req.body.reviveCategory;
var revivePhoto = req.file.filename;
var author = {
id: req.user._id,
username: req.user.name
};
var newRevive = {reviveShowName: reviveShowName, reviveGoal: reviveGoal, reviveTitle: reviveTitle, revivePhoto: revivePhoto, reviveVideo: reviveVideo, reviveStory: reviveStory, author: author, reviveCategory: reviveCategory};
Revive.create(newRevive, function(err, newlyCreatedRevive) {
if(err) {
console.log(err);
} else {
res.redirect('/');
}
});
};
J'Interrogation de la db et passer tout à home.pug et home.pug je suis en train de l'afficher:
Voici le code pour home.pug:
if revives
each revive, i in revives
.clearfix
a.slide.revive(href='#')
.media
img(src='/images/#{revive.revivePhoto}')
.funding
h2 $12,151 of #{revive.reviveGoal}
.funds
.fund-bar
.progress-bar(style='width:82%')
span.favorite
.copy
p.secondary 8.7/10 • Animation, Comedy
h3.ellipsis
h4=revive.reviveTitle
= revive.reviveTitle apparaît, # {} revive.reviveGoal apparaît ... L'image ne fonctionne pas et je ne peux pas comprendre pourquoi ...