diff --git a/includes/functions.php b/includes/functions.php index 708a174..ae9b913 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -92,3 +92,52 @@ function getAllTechnologies(): array sort($technologies); return $technologies; } + +/** + * Génère le HTML pour une image projet optimisée + * Utilise pour WebP avec fallback JPG + * + * @param string $filename Nom du fichier image (ex: project-thumb.webp) + * @param string $alt Texte alternatif + * @param int $width Largeur en pixels + * @param int $height Hauteur en pixels + * @param bool $lazy Activer le lazy loading (défaut: true) + * @param string $class Classes CSS additionnelles + * @return string HTML de l'image + */ +function projectImage(string $filename, string $alt, int $width, int $height, bool $lazy = true, string $class = ''): string +{ + $alt = htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); + $class = htmlspecialchars($class, ENT_QUOTES, 'UTF-8'); + $lazyAttr = $lazy ? 'loading="lazy"' : ''; + + // Détermine les chemins WebP et fallback + $basePath = '/assets/img/projects/'; + $webpFile = $filename; + + // Si le fichier n'est pas .webp, on essaie de trouver la version .webp + if (!str_ends_with($filename, '.webp')) { + $webpFile = preg_replace('/\.(jpg|jpeg|png)$/i', '.webp', $filename); + } + + // Fallback: remplace .webp par .jpg + $fallbackFile = str_replace('.webp', '.jpg', $webpFile); + + // Image par défaut si fichier manquant + $defaultImage = $basePath . 'default-project.svg'; + + return << + + {$alt} + +HTML; +} diff --git a/pages/project-single.php b/pages/project-single.php index 72d0845..cdf2029 100644 --- a/pages/project-single.php +++ b/pages/project-single.php @@ -1,9 +1,17 @@
-
+
-
-

-

- -

+ + + + +
+

+ +

+ + +
+ + + +
+ + +
+ + + Voir le projet en ligne + + + + + + + + + + + + Voir sur GitHub + + + + + Projet non disponible en ligne + +
+
+ + + +
+ +
+ + + +
+ +
+ + +
+

Contexte

+

+ +

+
+ + + + +
+

Solution Technique

+

+ +

+
+ + + + +
+

Travail d'Équipe

+

+ +

+
+ + + + +
+

Captures d'écran

+
+ +
+ +
+ +
+
+ +
+ + +
-

- Page en construction - Story 3.4 -

+ +
-
+
diff --git a/pages/projects.php b/pages/projects.php index dc30794..5caa272 100644 --- a/pages/projects.php +++ b/pages/projects.php @@ -8,6 +8,7 @@ $pageDescription = 'Découvrez mes réalisations web : sites vitrines, e-commerc $currentPage = 'projets'; $featuredProjects = getProjectsByCategory('vedette'); +$secondaryProjects = getProjectsByCategory('secondaire'); include_template('header', compact('pageTitle', 'pageDescription')); include_template('navbar', compact('currentPage')); @@ -39,7 +40,22 @@ include_template('navbar', compact('currentPage')); - + + +
+
+
+ +

Autres projets

+ +
+ + $project]); ?> + +
+
+
+ diff --git a/templates/project-card-compact.php b/templates/project-card-compact.php new file mode 100644 index 0000000..d13ed79 --- /dev/null +++ b/templates/project-card-compact.php @@ -0,0 +1,57 @@ + 100 + ? substr($context, 0, 100) . '...' + : $context; +?> + +
+
+ +
+ + + + + + + + +

+ +

+ + + +

+ +

+ +
+ + +
+ + + + + $maxTechs): ?> + + + +
+
+
diff --git a/templates/project-card.php b/templates/project-card.php index fa8600f..69e20b0 100644 --- a/templates/project-card.php +++ b/templates/project-card.php @@ -15,15 +15,14 @@ $maxTechs = 4;
- Aperçu du projet <?= htmlspecialchars($title, ENT_QUOTES, 'UTF-8') ?> +