Changeset 834bcc3 in Klonkt for src/services/ImageWebpService.js


Ignore:
Timestamp:
06/23/2026 06:14:27 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
d774679
Parents:
bb42dfb
Message:

i18n: translate Dutch code comments to English across src/

Comments in routes/services/views/config/middleware/assets translated to
English for the public repo. A few dev-facing throw/console message strings
were Englished too. No user-facing UI strings or i18n dictionary values changed
(src/services/i18n.js untouched). Logic unchanged.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ImageWebpService.js

    rbb42dfb r834bcc3  
    11/**
    2  * Zet een zojuist-geüploade afbeelding om naar WebP (kleiner, modern).
     2 * Convert a freshly uploaded image to WebP (smaller, modern format).
    33 *
    4  * Gebruikt het systeem-`cwebp` (libwebp). Aanwezig → converteer + verwijder het
    5  * origineel, geef de nieuwe .webp-bestandsnaam terug. Niet aanwezig of fout →
    6  * geef de originele bestandsnaam terug (graceful fallback, niks breekt).
     4 * Uses the system `cwebp` (libwebp). Present → convert + delete the original,
     5 * return the new .webp filename. Not present or error → return the original
     6 * filename (graceful fallback, nothing breaks).
    77 *
    8  * GIF blijft GIF (cwebp maakt geen geanimeerde webp van een gif); reeds-webp
    9  * wordt overgeslagen.
     8 * GIF stays GIF (cwebp cannot produce animated WebP from a GIF); already-WebP
     9 * files are skipped.
    1010 */
    1111import { execFileSync } from 'child_process';
     
    1717/**
    1818 * @param {{path:string, filename:string, destination?:string}} file  multer file
    19  * @returns {string} de definitieve bestandsnaam (basename) — .webp of het origineel
     19 * @returns {string} the final filename (basename) — .webp or the original
    2020 */
    2121export function toWebp(file) {
     
    2828  try {
    2929    execFileSync('cwebp', ['-quiet', '-q', QUALITY, file.path, '-o', outPath], { stdio: 'ignore' });
    30     if (!fs.existsSync(outPath) || fs.statSync(outPath).size === 0) throw new Error('lege output');
    31     try { fs.unlinkSync(file.path); } catch { /* origineel weg, niet kritisch */ }
     30    if (!fs.existsSync(outPath) || fs.statSync(outPath).size === 0) throw new Error('empty output');
     31    try { fs.unlinkSync(file.path); } catch { /* original gone, not critical */ }
    3232    return outName;
    3333  } catch (e) {
    34     console.warn('[webp] conversie overgeslagen (cwebp niet beschikbaar/fout):', e.message);
    35     try { if (fs.existsSync(outPath)) fs.unlinkSync(outPath); } catch {} // ruim halve output op
    36     return file.filename; // behoud origineel
     34    console.warn('[webp] conversion skipped (cwebp not available/error):', e.message);
     35    try { if (fs.existsSync(outPath)) fs.unlinkSync(outPath); } catch {} // clean up partial output
     36    return file.filename; // keep original
    3737  }
    3838}
Note: See TracChangeset for help on using the changeset viewer.