mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 03:21:18 +01:00
closes #6442
This commit is contained in:
@@ -5,6 +5,7 @@ var async = require('async');
|
||||
var nconf = require('nconf');
|
||||
var mime = require('mime');
|
||||
var fs = require('fs');
|
||||
var jimp = require('jimp');
|
||||
|
||||
var meta = require('../../meta');
|
||||
var file = require('../../file');
|
||||
@@ -273,6 +274,17 @@ function uploadImage(filename, folder, uploadedFile, req, res, next) {
|
||||
], function (err) {
|
||||
next(err, imageData);
|
||||
});
|
||||
} else if (path.basename(filename, path.extname(filename)) === 'og:image' && folder === 'system') {
|
||||
jimp.read(imageData.path).then(function (image) {
|
||||
meta.configs.setMultiple({
|
||||
'og:image:height': image.bitmap.height,
|
||||
'og:image:width': image.bitmap.width,
|
||||
}, function (err) {
|
||||
next(err, imageData);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
next(err);
|
||||
});
|
||||
} else {
|
||||
setImmediate(next, null, imageData);
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ Tags.parse = function (req, data, meta, link, callback) {
|
||||
}
|
||||
addIfNotExists(meta, 'property', 'og:image', ogImage);
|
||||
if (ogImage) {
|
||||
addIfNotExists(meta, 'property', 'og:image:width', 200);
|
||||
addIfNotExists(meta, 'property', 'og:image:height', 200);
|
||||
addIfNotExists(meta, 'property', 'og:image:width', Meta.config['og:image:width'] || 200);
|
||||
addIfNotExists(meta, 'property', 'og:image:height', Meta.config['og:image:height'] || 200);
|
||||
}
|
||||
|
||||
link = results.links.links.concat(link || []);
|
||||
|
||||
Reference in New Issue
Block a user