make accessible the fuzzy hashes to filter ref #371

jschan
Thomas Lynch 3 years ago
parent 70a45a9380
commit 984d9428f5
  1. 1
      helpers/imagehash.js
  2. 5
      models/forms/makepost.js
  3. 2
      views/pages/globalmanagesettings.pug

@ -11,7 +11,6 @@ module.exports = async (req, res, next) => {
const mainType = req.files.file[i].mimetype.split('/')[0]; const mainType = req.files.file[i].mimetype.split('/')[0];
if (mainType === 'image' || mainType === 'video') { if (mainType === 'image' || mainType === 'video') {
hashPromises.push(imageHash(req.files.file[i].tempFilePath, 8, 'hex').then(res => { hashPromises.push(imageHash(req.files.file[i].tempFilePath, 8, 'hex').then(res => {
console.log(res.hash);
req.files.file[i].phash = res.hash; req.files.file[i].phash = res.hash;
})); }));
} }

@ -248,6 +248,11 @@ ${res.locals.numFiles > 0 ? req.files.file.map(f => f.name+'|'+(f.phash || '')).
extension, extension,
}; };
//phash
if (file.phash) {
processedFile.phash = file.phash;
}
//type and subtype //type and subtype
let [type, subtype] = processedFile.mimetype.split('/'); let [type, subtype] = processedFile.mimetype.split('/');
//check if already exists //check if already exists

@ -76,7 +76,7 @@ block content
.label Thumbnail File Extension .label Thumbnail File Extension
input(type='text' name='thumb_extension' value=settings.thumbExtension) input(type='text' name='thumb_extension' value=settings.thumbExtension)
.row .row
.label Hash Images .label Fuzzy Hash Images
label.postform-style.ph-5 label.postform-style.ph-5
input(type='checkbox', name='hash_images' value='true' checked=settings.hashImages) input(type='checkbox', name='hash_images' value='true' checked=settings.hashImages)
.row .row

Loading…
Cancel
Save