This commit is contained in:
tree 2023-04-19 01:58:20 +02:00
rodič dff3e06475
revize 6a1000ff45
11 změnil soubory, kde provedl 17 přidání a 6 odebrání

Binární soubor nebyl zobrazen.

Před

Šířka:  |  Výška:  |  Velikost: 0 B

Za

Šířka:  |  Výška:  |  Velikost: 48 KiB

Zobrazit soubor

@ -52,17 +52,17 @@ id = "pavol-luptak"
[[speakers]]
id = "lea-patras"
name = "Lea Patras"
photo = "photos/speakers/lea-patras.jpg"
photo = "photos/speakers/lea-patras.jpeg"
twitter = "LeaPetras"
[[speakers]]
id = "max-hillebrand"
name = "Max Hillebrand"
photo = "photos/speakers/max-hillebrand.jpg"
photo = "photos/speakers/max-hillebrand.jpeg"
twitter = "HillebrandMax"
[[speakers]]
id = "pavlenex"
name = "Pavlenex"
photo = "photos/speakers/pavlenex.jpg"
photo = "photos/speakers/pavlenex.jpeg"
twitter = "pavlenex"

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 18 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 8.9 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 75 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 69 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 24 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 12 KiB

Binární soubor nebyl zobrazen.

Za

Šířka:  |  Výška:  |  Velikost: 33 KiB

Binární soubor nebyl zobrazen.

Před

Šířka:  |  Výška:  |  Velikost: 0 B

Za

Šířka:  |  Výška:  |  Velikost: 58 KiB

Zobrazit soubor

@ -283,11 +283,17 @@ class DeConf_Collection {
return null;
}
const src = [this.dir, fn].join("/");
const extname = posix.extname(src);
const dest = [this.dir, fn.replace(/\.([^\.]+)$/, ".op.webp")].join("/");
//console.log({src, dest})
if (await exists(dest)) {
return null;
}
if (extname === ".webp") {
await _fileCopy(src, dest);
console.log(`${dest} copied`);
return true;
}
await _imageOptimalizedWrite(src, dest);
console.log(`${dest} writed`);
}
@ -350,8 +356,7 @@ class DeConf_Collection {
//console.log(fnIn, asset);
let fnOut = [this.id, asset].join("/");
await emptyDir([outputDir, this.id].join("/"));
const opPath = fnIn.replace(/[^\.]+$/, "op.webp");
const opOutPath = fnIn.replace(/[^\.]+$/, "webp");
const [opPath, opOutPath] = this.opResolve(fnIn);
const opFn = [this.dir, opPath].join("/");
if (await exists(opFn)) {
fnIn = opPath;
@ -389,6 +394,10 @@ class DeConf_Collection {
}
}
opResolve(fn) {
return [fn.replace(/[^\.]+$/, "op.webp"), fn.replace(/[^\.]+$/, "webp")];
}
toJSON() {
return Object.assign({ id: this.id }, this.data.index, this.data.sync);
}
@ -407,7 +416,9 @@ async function _imageOptimalizedWrite(src, dest, resize = null) {
if (resize) {
cmd.push(`-resize ${resize}`);
}
await Deno.run({ cmd, stdout: "null", stderr: "null" });
const p = Deno.run({ cmd, stdout: "piped", stderr: "piped" });
await p.status();
console.log(new TextDecoder().decode(await p.stderrOutput()));
}
async function _fileCopy(from, to) {