|
|
|
@ -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); |
|
|
|
|