diff --git a/app.js b/app.js index 00fa1da..f771ffa 100644 --- a/app.js +++ b/app.js @@ -82,13 +82,13 @@ module.exports = app; function BOB_initConfig() { // Config var cfgConfig = { - background : '#fff0ff', - margins : 0.01, + background : '#ffffff', + margins : 0.005, style : 'default', nbPicture : 4, cropSize : { width : 900, - height : 1125 + height : 1200 }, pictNames : [], layout : [], @@ -98,7 +98,8 @@ function BOB_initConfig() { template : "", prebuilt : "", original : "" - } + }, + footer : BOB_mod_path.resolve(__dirname, './public/img/footer', 'm-cloclo.jpg') }; // Init PATH cfgConfig.paths.final = BOB_mod_path.resolve(__dirname, './public/img/final'); diff --git a/public/img/footer/cloclo.jpg b/public/img/footer/cloclo.jpg new file mode 100644 index 0000000..b1accf3 Binary files /dev/null and b/public/img/footer/cloclo.jpg differ diff --git a/public/img/footer/m-cloclo.jpg b/public/img/footer/m-cloclo.jpg new file mode 100644 index 0000000..0d77ec4 Binary files /dev/null and b/public/img/footer/m-cloclo.jpg differ diff --git a/tools/tools-gphoto2.js b/tools/tools-gphoto2.js index 79c3b26..a69da9f 100644 --- a/tools/tools-gphoto2.js +++ b/tools/tools-gphoto2.js @@ -36,7 +36,12 @@ BOB_module.getConfig = function(pCallback) { BOB_module.takePicture = function(pBoothId, pPictId, pCallback) { var destPath = BOB_mod_path.join(BOB_cfg_config.paths.original, pBoothId); - var pictPath = BOB_mod_path.join(destPath, BOB_cfg_config.pictNames[pPictId]); + var pbltPath = BOB_mod_path.join(BOB_cfg_config.paths.prebuilt, pBoothId); + var pictOrig = BOB_mod_path.join(destPath, BOB_cfg_config.pictNames[pPictId]); + var pictPblt = BOB_mod_path.join(destPath, BOB_cfg_config.pictNames[pPictId]); + + + BOB_mod_mkdirp.sync(BOB_mod_path.join(BOB_cfg_config.paths.prebuilt, pBoothId)); BOB_upCameraReference(function() { if( BOB_var_camera === null ) { @@ -49,16 +54,16 @@ BOB_module.takePicture = function(pBoothId, pPictId, pCallback) { // Else write file on ddisk } else { BOB_mod_mkdirp(destPath, function() { - BOB_mod_fs.writeFile(pictPath, pData, function(pErr) { - BOB_mod_gm(pictPath) + BOB_mod_fs.writeFile(pictOrig, pData, function(pErr) { + BOB_mod_gm(pictOrig) .autoOrient() .gravity('Center') - .resize(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height, "^") - .crop(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height) + // .resize(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height, "^") + // .crop(BOB_cfg_config.cropSize.width, BOB_cfg_config.cropSize.height) // .modulate(100, 0) // .contrast(+2) - .write(dstPict, function(pErr) { - return pCallback(pErr, pictPath) + .write(pictOrig, function(pErr) { + return pCallback(pErr, pictPblt) }) }); }) diff --git a/tools/tools-photobooth.js b/tools/tools-photobooth.js index 88da4d8..ef6911a 100644 --- a/tools/tools-photobooth.js +++ b/tools/tools-photobooth.js @@ -19,13 +19,11 @@ BOB_module.getBoothList = function(pFrom, pCallback) { } BOB_module.buildBooth = function(pBoothId, pCallback) { - var index = 0; - var funcResizeArray = []; - + // Create output prebuild directory BOB_mod_mkdirp.sync(BOB_mod_path.join(BOB_cfg_config.paths.prebuilt, pBoothId)); - - BOB_cfg_config.pictNames.forEach(function(pPictName) { - funcResizeArray.push(function(pCb) { + // Resize pictures + BOB_mod_async.mapSeries(BOB_cfg_config.pictNames, + function(pPictName, pCb) { var srcPict = BOB_mod_path.join(BOB_cfg_config.paths.original, pBoothId, pPictName); var dstPict = BOB_mod_path.join(BOB_cfg_config.paths.prebuilt, pBoothId, pPictName); @@ -39,21 +37,17 @@ BOB_module.buildBooth = function(pBoothId, pCallback) { // .modulate(100, 0) // .contrast(+2) .write(dstPict, function(pErr) { + if(pErr) console.log("Failed to resize picture", pErr) pCb() }) - }) - }) - - BOB_mod_async.parallel( - funcResizeArray, - function(pErr, pData) { + }, + function(pErr) { console.log("Building booth") switch(BOB_cfg_config.style) { default : BOB_generateBooth(pBoothId, 'default', pCallback); } - } - ) + }) } function BOB_generateBooth(pBoothId, pType, pCallback) { @@ -67,6 +61,8 @@ function BOB_generateBooth(pBoothId, pType, pCallback) { outPict.fill(BOB_cfg_config.background); outPict.drawRectangle(0, 0, BOB_cfg_config.booths[pType].resolution.width, BOB_cfg_config.booths[pType].resolution.height); + outPict.draw('image Over 0,2080 1600,300 \''+BOB_cfg_config.footer+'\''); + BOB_cfg_config.pictNames.forEach(function(pPictName, pIndex) { var cmdDraw = 'image Over'; cmdDraw += ' '+BOB_cfg_config.booths[pType].layout[pIndex].x; @@ -79,9 +75,9 @@ function BOB_generateBooth(pBoothId, pType, pCallback) { outPict.draw(cmdDraw); }) - outPict.fill("#000000"); - outPict.pointSize(40); - outPict.draw('text 1900,3850 "'+printedDate.toUTCString()+'"'); + outPict.fill("#666"); + outPict.pointSize(20); + outPict.draw('text 1250,2350 "'+printedDate.toUTCString()+'"'); outPict.write(finalPict, function (pErr) { if( pErr ) { @@ -140,8 +136,8 @@ function BOB_updateConfig() { function BOB_generatePictLayout(pBoothName) { var index = 0; - var marginX = 50; - var marginY = 50; + var marginX = 20; + var marginY = 20; var pictWidth = ( BOB_cfg_config.booths[pBoothName].resolution.width - 3 * marginX ) / 2; var pictHeight = parseInt(pictWidth * BOB_cfg_config.cropSize.height / BOB_cfg_config.cropSize.width); diff --git a/views/index.ejs b/views/index.ejs index 6cff81e..731b2a5 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -133,7 +133,7 @@ function BOB_displayPictPreview(pBoothId, pPictureId, pCallback) { $('#idBoothPanel').fadeIn(50, function() { pCallback() }) - }, 2000) + }, 4000) }) }