diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php
index de875d1..57e62f9 100644
--- a/Controllers/RecipeController.php
+++ b/Controllers/RecipeController.php
@@ -73,4 +73,21 @@ final class RecipeController
));
}
+ public function imgAction(Array $A_urlParams = null, Array $A_postParams = null, Array $A_getParams = null)
+ {
+ if (count($A_urlParams) !== 1 ) throw new HTTPSpecialCaseException(404);
+
+ $O_recipeModel = new RecipeModel();
+ $A_recipe = $O_recipeModel->getRecipeByID($A_urlParams[0]);
+
+ header("Content-Type: image");
+ if (isset($A_recipe) && $A_recipe["IMG"] !== null) {
+ echo $A_recipe["IMG"];
+ } else {
+ echo file_get_contents(Constants::rootDir()."/static/img/default_recipe.jpg");
+ }
+
+ return Utils::RETURN_RAW;
+ }
+
}
diff --git a/Controllers/UserController.php b/Controllers/UserController.php
index 3bf0950..2c8eeb2 100644
--- a/Controllers/UserController.php
+++ b/Controllers/UserController.php
@@ -201,10 +201,11 @@ final class UserController
throw new HTTPSpecialCaseException(404);
}
- header("Content-Type: image/png");
if ($A_user["PROFILE_PIC"] === null) {
- echo file_get_contents(Constants::rootDir()."/static/img/generic_user.jpg");
+ header("Content-Type: image/svg+xml");
+ echo file_get_contents(Constants::rootDir()."/static/img/default_user.svg");
} else {
+ header("Content-Type: image");
echo $A_user["PROFILE_PIC"];
}
diff --git a/Views/common/header.php b/Views/common/header.php
index cf0b9d9..2bee9e0 100644
--- a/Views/common/header.php
+++ b/Views/common/header.php
@@ -4,7 +4,7 @@ $array_header = array(
"Recette" => "/Recipe/view/36",
"+" => "/recipe/edit",
"Rechercher" => "rechercher",
- '
' => "/user/view"
+ '
' => "/user/view"
);
?>
diff --git a/static/img/default_recipe.jpg b/static/img/default_recipe.jpg
new file mode 100644
index 0000000..1cb1e00
Binary files /dev/null and b/static/img/default_recipe.jpg differ
diff --git a/static/img/defaultProfil.svg b/static/img/default_user.svg
similarity index 100%
rename from static/img/defaultProfil.svg
rename to static/img/default_user.svg
diff --git a/static/img/generic_user.jpg b/static/img/generic_user.jpg
deleted file mode 100644
index 01217ee..0000000
Binary files a/static/img/generic_user.jpg and /dev/null differ
diff --git a/static/img/recipes/1.jpg b/static/img/recipes/1.jpg
deleted file mode 100644
index 0b5d3f7..0000000
Binary files a/static/img/recipes/1.jpg and /dev/null differ
diff --git a/static/img/recipes/2.jpg b/static/img/recipes/2.jpg
deleted file mode 100644
index 868c807..0000000
Binary files a/static/img/recipes/2.jpg and /dev/null differ