This commit is contained in:
ChK
2026-04-05 08:08:13 +02:00
parent d2096eca70
commit edb7c825fc
3 changed files with 33 additions and 4 deletions

View File

@@ -209,6 +209,8 @@ app.get('/api/latest-snapshot', (req, res) => {
const baseName = path.basename(latestFile.name, path.extname(latestFile.name));
const imageFilename = `${baseName}_annotated.jpg`;
const imagePath = path.join(snapshotsDir, imageFilename);
const imatePath2 = imagePath.includes('video0') ? imagePath.replace('video0', 'video1') : imagePath.replace('video1', 'video0');
fs.readFile(latestFile.path, 'utf8', (err, data) => {
if (err) {
@@ -221,6 +223,7 @@ app.get('/api/latest-snapshot', (req, res) => {
content: data
};
// Lade beide Bilder
fs.readFile(imagePath, { encoding: 'base64' }, (jpgErr, jpgBase64) => {
if (!jpgErr && jpgBase64) {
response.imageFile = {
@@ -229,7 +232,17 @@ app.get('/api/latest-snapshot', (req, res) => {
contentBase64: jpgBase64
};
}
res.json(response);
fs.readFile(imatePath2, { encoding: 'base64' }, (jpgErr2, jpgBase642) => {
if (!jpgErr2 && jpgBase642) {
response.image2 = {
filename: path.basename(imatePath2),
mimeType: 'image/jpeg',
contentBase64: jpgBase642
};
}
res.json(response);
});
});
});
});