This commit is contained in:
2026-07-14 22:06:09 +02:00
parent 211f68c7c8
commit 7da130c456
50 changed files with 16760 additions and 0 deletions
Executable
+69
View File
@@ -0,0 +1,69 @@
<?php
$PROJECT_TITLE = 'Portfolio - mschwab.net';
$MAIL = 'ms@mschwab.net';
$MOBILE = '+41 78 819 76 00';
$WEB_URL = 'https://www.mschwab.net';
$IMMICH_URL = 'https://immich.mschwab.net';
$IMMICH_API_KEY = 'xzANIBPSjx7iHJTK6OKV2yLyDPy9Vh4NAKnCJ3t4U';
function immichRequest($url) {
global $IMMICH_API_KEY;
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"x-api-key: $IMMICH_API_KEY",
"Accept: application/json"
]
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
function getThumbnailBase64($assetId) {
global $IMMICH_URL, $IMMICH_API_KEY;
$ch = curl_init("$IMMICH_URL/api/assets/$assetId/thumbnail?size=thumbnail");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"x-api-key: $IMMICH_API_KEY"
]
]);
$image = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
return "data:$contentType;base64," . base64_encode($image);
}
function logData(string $message, ?array $data = null) {
$logDir = '../logs';
$today = date('Y-m-d');
$now = date('Y-m-d H:i:s');
$date = new DateTime("now", new DateTimeZone('Europe/Zurich'));
if (!is_dir($logDir)) {
mkdir($logDir, 0777, true);
}
$logFile = $logDir . '/log-' . $date->format('Y-m-d') . '.log';
$logData = '[' . $date->format('Y-m-d H:i:s') . ']' . ' - ' . $message . "\n";
if ($data) {
$dataString = print_r($data, true) . "\n";
$logData .= $dataString;
}
file_put_contents($logFile, $logData, FILE_APPEND);
}