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,7 +470,8 @@ var SharpActions = actions.Actions({
|| img.base_path || img.base_path
|| this.location.path || this.location.path
return sizes return Promise.all(
sizes
.map(function(size, i){ .map(function(size, i){
var name = path = path_tpl var name = path = path_tpl
.replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size)) .replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size))
@ -490,18 +491,13 @@ var SharpActions = actions.Actions({
}) })
// XXX handle errors -- rejected because image exists... // XXX handle errors -- rejected because image exists...
.then(function(res){ .then(function(res){
// did not create a preview...
if(!res){
return false }
// update metadata... // update metadata...
if(!base_path){ if(!base_path){
var preview = img.preview = img.preview || {} var preview = img.preview = img.preview || {}
preview[parseInt(size) + 'px'] = name preview[parseInt(size) + 'px'] = name
that.markChanged that.markChanged
&& that.markChanged('images', [gid]) } && that.markChanged('images', [gid]) }
return [gid, size, name] }) })) })],
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...