Add the EBI Immobilien redesign draft
Rebuild of ebi-immobilien.de (Karlsruhe) in its own installation on ports 8106/8107: home page, search request and valuation as step forms, contact, legal pages and redirects for the old WordPress addresses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7fb4d2bfbd
commit
233bab1e43
6 files changed
+1140
-1
No files matched your search
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Bereitet die Bilder von ebi-immobilien.de für die Mediathek des Nachbaus vor.
|
||||
*
|
||||
* Quelle sind die Originaldateien der laufenden Website (wp-content/uploads, am 13.10.2026
|
||||
* abgerufen). Daraus entstehen:
|
||||
* - logo.png: das Logo „EBI Immobilien“ ohne Rand, 680 px breit (Original 1361 × 407),
|
||||
* - favicon.png: das Seitensymbol der Website (192 × 192),
|
||||
* - startbild.webp: „startbild.*“ aus dem Quellordner, sonst das Wohnquartier aus dem Original-Hero,
|
||||
* - bewertung.webp: Ordner, Rechner und Stift (Original „workbook“), auf 1600 px verkleinert,
|
||||
* - schreibtisch.webp: Schreibtisch mit Brille und Notizblock (Original „services-h-fig“).
|
||||
*
|
||||
* Aufruf: php scripts/build-ebi-immobilien-assets.php <Ordner mit den Originalen> <Zielordner>
|
||||
*/
|
||||
$quelle = rtrim($argv[1] ?? '', '/\\');
|
||||
$ziel = rtrim($argv[2] ?? '', '/\\');
|
||||
if ('' === $quelle || '' === $ziel || !is_file($quelle.'/EBI.png')) {
|
||||
fwrite(STDERR, "Aufruf: php scripts/build-ebi-immobilien-assets.php <Ordner mit EBI.png usw.> <Zielordner>\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!is_dir($ziel) && !mkdir($ziel, 0775, true)) {
|
||||
fwrite(STDERR, "Zielordner lässt sich nicht anlegen: $ziel\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/** Ein Ausschnitt, auf eine Zielbreite verkleinert, als WebP. */
|
||||
$webp = static function (string $datei, string $name, int $x, int $y, int $b, int $h, int $breite) use ($quelle, $ziel): void {
|
||||
$pfad = $quelle.'/'.$datei;
|
||||
$bild = str_ends_with($datei, '.png') ? imagecreatefrompng($pfad) : imagecreatefromjpeg($pfad);
|
||||
if (false === $bild) {
|
||||
fwrite(STDERR, "Bild lässt sich nicht lesen: $pfad\n");
|
||||
exit(1);
|
||||
}
|
||||
$hoehe = (int) round($h * $breite / $b);
|
||||
$neu = imagecreatetruecolor($breite, $hoehe);
|
||||
imagecopyresampled($neu, $bild, 0, 0, $x, $y, $breite, $hoehe, $b, $h);
|
||||
imagewebp($neu, $ziel.'/'.$name, 78);
|
||||
echo "$name: {$breite} × {$hoehe}\n";
|
||||
};
|
||||
|
||||
// Startbild: liegt im Quellordner eine Datei „startbild.jpg/.png/.webp“ (z. B. ein neu erzeugtes
|
||||
// Bild), wird sie auf 1920 px Breite und höchstens 16:9 gebracht. Sonst das Original-Hero, das oben
|
||||
// einen 116 px hohen grauen Balken trägt (Zuschnitt des Themes).
|
||||
$eigenes = glob($quelle.'/startbild.{jpg,jpeg,png,webp}', GLOB_BRACE) ?: [];
|
||||
if ([] !== $eigenes) {
|
||||
$pfad = $eigenes[0];
|
||||
$bild = match (strtolower(pathinfo($pfad, PATHINFO_EXTENSION))) {
|
||||
'png' => imagecreatefrompng($pfad),
|
||||
'webp' => imagecreatefromwebp($pfad),
|
||||
default => imagecreatefromjpeg($pfad),
|
||||
};
|
||||
$b = imagesx($bild);
|
||||
$h = min(imagesy($bild), (int) round($b * 9 / 16));
|
||||
$y = (int) round((imagesy($bild) - $h) / 2);
|
||||
$breite = min(1920, $b);
|
||||
$hoehe = (int) round($h * $breite / $b);
|
||||
$neu = imagecreatetruecolor($breite, $hoehe);
|
||||
imagecopyresampled($neu, $bild, 0, 0, 0, $y, $breite, $hoehe, $b, $h);
|
||||
imagewebp($neu, $ziel.'/startbild.webp', 78);
|
||||
echo "startbild.webp aus ".basename($pfad).": {$breite} × {$hoehe}\n";
|
||||
} else {
|
||||
$webp('karlsruhe-3518473_1920-e1600241476184.png', 'startbild.webp', 0, 118, 1920, 722, 1920);
|
||||
}
|
||||
$webp('workbook-1205044_1920-1920x1280.jpg', 'bewertung.webp', 0, 0, 1920, 1280, 1600);
|
||||
$webp('services-h-fig-1920x1280.jpg', 'schreibtisch.webp', 0, 0, 1920, 1280, 1600);
|
||||
|
||||
// Logo: durchsichtigen Rand abschneiden und verkleinern.
|
||||
$logo = imagecreatefrompng($quelle.'/EBI.png');
|
||||
[$links, $oben, $rechts, $unten] = [imagesx($logo), imagesy($logo), 0, 0];
|
||||
for ($y = 0; $y < imagesy($logo); ++$y) {
|
||||
for ($x = 0; $x < imagesx($logo); ++$x) {
|
||||
if ((imagecolorat($logo, $x, $y) >> 24 & 0x7F) < 120) {
|
||||
$links = min($links, $x);
|
||||
$rechts = max($rechts, $x);
|
||||
$oben = min($oben, $y);
|
||||
$unten = max($unten, $y);
|
||||
}
|
||||
}
|
||||
}
|
||||
$b = $rechts - $links + 1;
|
||||
$h = $unten - $oben + 1;
|
||||
$breite = 680;
|
||||
$hoehe = (int) round($h * $breite / $b);
|
||||
$neu = imagecreatetruecolor($breite, $hoehe);
|
||||
imagealphablending($neu, false);
|
||||
imagesavealpha($neu, true);
|
||||
imagefill($neu, 0, 0, imagecolorallocatealpha($neu, 0, 0, 0, 127));
|
||||
imagecopyresampled($neu, $logo, 0, 0, $links, $oben, $breite, $hoehe, $b, $h);
|
||||
imagepng($neu, $ziel.'/logo.png', 9);
|
||||
echo "logo.png: {$breite} × {$hoehe}\n";
|
||||
|
||||
copy($quelle.'/cropped-favicon-192x192.png', $ziel.'/favicon.png');
|
||||
echo "favicon.png übernommen\n";
|
||||
Reference in new issue
Block a user