![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/backups/lavocat.quebec/backup-20250730-021618/scripts/ |
const sharp = require('sharp');
const fs = require('fs');
const path = require('path');
// Ensure the images directory exists
const imagesDir = path.join(__dirname, '../public/images');
if (!fs.existsSync(imagesDir)) {
fs.mkdirSync(imagesDir, { recursive: true });
}
// Function to create a placeholder image
async function createPlaceholder(name, width, height, color) {
const outputPath = path.join(imagesDir, name);
await sharp({
create: {
width,
height,
channels: 4,
background: color
}
})
.toFile(outputPath);
console.log(`Created ${name}`);
}
// Create all placeholder images
async function generateAll() {
try {
await createPlaceholder('habeas-corpus.jpg', 800, 600, { r: 240, g: 240, b: 240, alpha: 1 });
await createPlaceholder('courtyard.jpg', 800, 600, { r: 200, g: 220, b: 200, alpha: 1 });
await createPlaceholder('cell.jpg', 800, 600, { r: 220, g: 220, b: 220, alpha: 1 });
await createPlaceholder('common-area.jpg', 800, 600, { r: 220, g: 200, b: 200, alpha: 1 });
// Create favicon
await sharp({
create: {
width: 32,
height: 32,
channels: 4,
background: { r: 79, g: 70, b: 229, alpha: 1 }
}
})
.toFile(path.join(__dirname, '../public/favicon.ico'));
console.log('Created favicon.ico');
} catch (error) {
console.error('Error generating placeholders:', error);
}
}
generateAll();