bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-08 20:07:49 +03:00
parent d19b678b37
commit d2a5e3c15e
3 changed files with 36 additions and 41 deletions

View File

@ -2693,13 +2693,12 @@ function(title, func){
&& ([items, ...args] = && ([items, ...args] =
arg_handler.call(this, undefined, items, ...args)) arg_handler.call(this, undefined, items, ...args))
// run... // run...
;(items instanceof Array ? return Promise.all(
(items instanceof Array ?
items items
: [items]) : [items])
.map(function(item){ .map(function(item){
return func.call(that, item, ...args) }) return func.call(that, item, ...args) }))
// XXX should we return anything in sync mode???
return Promise.resolve()
// queue mode... // queue mode...
} else { } else {

View File

@ -57,13 +57,13 @@ var IndexFormatActions = actions.Actions({
// XXX should these be 'p' or 'px' (current)??? // XXX should these be 'p' or 'px' (current)???
'preview-sizes': [ 'preview-sizes': [
75, //75,
200, //200,
480, 480,
900, //900,
1080, 1080,
1440, //1440,
2160, //2160,
], ],
'preview-sizes-priority': [ 'preview-sizes-priority': [
75, 75,

View File

@ -470,38 +470,34 @@ var SharpActions = actions.Actions({
|| img.base_path || img.base_path
|| this.location.path || this.location.path
return sizes return Promise.all(
.map(function(size, i){ sizes
var name = path = path_tpl .map(function(size, i){
.replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size)) var name = path = path_tpl
.replace(/\$GID|\$\{GID\}/g, gid) .replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size))
.replace(/\$NAME|\$\{NAME\}/g, img.name) .replace(/\$GID|\$\{GID\}/g, gid)
// NOTE: we are 'sync' here for several reasons, mainly because .replace(/\$NAME|\$\{NAME\}/g, img.name)
// this is a small list and in this way we can take // NOTE: we are 'sync' here for several reasons, mainly because
// advantage of OS file caching, and removing the queue // this is a small list and in this way we can take
// overhead, though small makes this noticeably faster... // advantage of OS file caching, and removing the queue
return that.makeResizedImage('sync', gid, size, base, { // overhead, though small makes this noticeably faster...
name, return that.makeResizedImage('sync', gid, size, base, {
skipSmaller: true, name,
transform: false, skipSmaller: true,
logger: logger_mode == 'gids' ? transform: false,
false logger: logger_mode == 'gids' ?
: logger, false
}) : logger,
// XXX handle errors -- rejected because image exists... })
.then(function(res){ // XXX handle errors -- rejected because image exists...
// did not create a preview... .then(function(res){
if(!res){ // update metadata...
return false } if(!base_path){
var preview = img.preview = img.preview || {}
// update metadata... preview[parseInt(size) + 'px'] = name
if(!base_path){ that.markChanged
var preview = img.preview = img.preview || {} && that.markChanged('images', [gid]) }
preview[parseInt(size) + 'px'] = name return [gid, size, name] }) })) })],
that.markChanged
&& that.markChanged('images', [gid]) }
return [gid, size, name] }) }) })],
// XXX add support for offloading the processing to a thread/worker... // XXX add support for offloading the processing to a thread/worker...
// XXX revise logging and logger passing... // XXX revise logging and logger passing...