Added Fetch Image from URL feature + Storm filelocks fixes + bulma inclusion into core

This commit is contained in:
NGPixel
2016-10-16 19:09:43 -04:00
parent 91d524eb06
commit 741a6674af
55 changed files with 3119 additions and 102 deletions

View File

@@ -8,6 +8,7 @@ var path = require('path'),
farmhash = require('farmhash'),
moment = require('moment'),
chokidar = require('chokidar'),
sharp = require('sharp'),
_ = require('lodash');
/**
@@ -35,10 +36,18 @@ module.exports = {
self._uploadsPath = path.resolve(ROOTPATH, appconfig.paths.repo, 'uploads');
self._uploadsThumbsPath = path.resolve(ROOTPATH, appconfig.paths.data, 'thumbs');
// Disable Sharp cache, as it cause file locks issues when deleting uploads.
sharp.cache(false);
return self;
},
/**
* Watch the uploads folder for changes
*
* @return {Void} Void
*/
watch() {
let self = this;
@@ -169,6 +178,13 @@ module.exports = {
},
/**
* Get metadata from file and generate thumbnails if necessary
*
* @param {String} fldName The folder name
* @param {String} f The filename
* @return {Promise<Object>} Promise of the file metadata
*/
processFile(fldName, f) {
let self = this;
@@ -248,8 +264,6 @@ module.exports = {
*/
generateThumbnail(sourcePath, destPath) {
let sharp = require('sharp');
return sharp(sourcePath)
.withoutEnlargement()
.resize(150,150)
@@ -269,8 +283,6 @@ module.exports = {
*/
getImageMetadata(sourcePath) {
let sharp = require('sharp');
return sharp(sourcePath).metadata();
}