我正在使用 mongoose-thumbnail 来获取我上传的图像的缩略图,我完全按照 github mongoose-thumbnail 示例中的方式完成了它,并且效果很好,下面是我的代码
var mongoose = require('mongoose');
var thumbnailPluginLib = require('mongoose-thumbnail');
var path = require('path');
var thumbnailPlugin = thumbnailPluginLib.thumbnailPlugin;
var make_upload_to_model = thumbnailPluginLib.make_upload_to_model;
var uploads_base = path.join(__dirname, "uploads");
var uploads = path.join(uploads_base, "u");
var Schema = mongoose.Schema;
var ApplicationSchema = new Schema({
appName: String,
appTempPath:String,
userId : String,
status : String,
templateId: String,
appSettings:[{header: String, color: String, font: String, fontSize: Number, backImg: String}]
});
ApplicationSchema.plugin(thumbnailPlugin, {
name: "appIcon",
inline: true,
upload_to: make_upload_to_model(uploads, 'appIcon')
});
var Application = mongoose.model('Application', ApplicationSchema);
我的问题是如何找到“上传”和“u”目录?我在我的目录中的任何地方都找不到它,请帮助。