2) { $description = implode("
", array_slice($lines, 2)); // A. Match full Instagram URLs (e.g. https://www.instagram.com/studiomajella/) and replace them with a styled link showing just the handle (@studiomajella) $description = preg_replace( '/https?:\/\/(?:www\.)?instagram\.com\/([a-zA-Z0-9_\.]+)\/?/i', '@$1', $description ); // B. Match standalone @handles (e.g. @studiomajella) and convert them to Instagram links (avoids matching e-mails) $description = preg_replace( '/(?@$1', $description ); } } // Fallback title from folder name if info.txt is empty if (empty($title)) { $cleanName = preg_replace('/^\d+[_|-]/', '', $dir); $title = str_replace(['_', '-'], ' ', $cleanName); } // 2. Find all images/videos in the folder $mediaList = []; $allowedImageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'gif']; $allowedVideoExtensions = ['mp4', 'mov', 'webm']; if ($handle = opendir($path)) { while (false !== ($entry = readdir($handle))) { if ($entry !== '.' && $entry !== '..') { $ext = strtolower(pathinfo($entry, PATHINFO_EXTENSION)); if (in_array($ext, $allowedImageExtensions)) { $mediaList[] = [ 'src' => 'projects/' . $dir . '/' . $entry, 'type' => 'image', 'filename' => $entry ]; } else if (in_array($ext, $allowedVideoExtensions)) { $mediaList[] = [ 'src' => 'projects/' . $dir . '/' . $entry, 'type' => 'video', 'filename' => $entry ]; } } } closedir($handle); } // Sort media items alphabetically by filename usort($mediaList, function($a, $b) { return strcmp($a['filename'], $b['filename']); }); $projects[] = [ 'folder' => $dir, 'title' => $title, 'subtitle' => $subtitle, 'description' => $description, 'media' => $mediaList ]; } } // Filter out any projects that have no media $projects = array_values(array_filter($projects, function($proj) { return count($proj['media']) > 0; })); ?> Majella – Selected Works

– Bisher keine Projekte geladen –

Erstelle einen Ordner in "/projects/" (z.B. "01_loungesessel"), um Arbeiten anzuzeigen.

$proj): $numMedia = count($proj['media']); if ($numMedia === 0) continue; $displayNum = str_pad(count($projects) - $index, 2, '0', STR_PAD_LEFT); // Scan to see if this project contains at least one video asset $hasVideo = false; $firstVideoId = ""; foreach ($proj['media'] as $itemIndex => $item) { if ($item['type'] === 'video') { $hasVideo = true; $firstVideoId = "video-" . $index . "-" . $itemIndex; break; } } $isLast = ($index === count($projects) - 1); $extraHeight = $isLast ? 100 : 0; ?>
$item): ?>
<?php echo htmlspecialchars($proj['title']); ?>
1): ?>