Merge pull request #67 from ThomasRubini/img

This commit is contained in:
Thomas Rubini 2023-01-24 18:10:54 +01:00 committed by GitHub
commit 7bcd774c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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"];
}

View File

@ -4,7 +4,7 @@ $array_header = array(
"Recette" => "/Recipe/view/36",
"+" => "/recipe/edit",
"Rechercher" => "rechercher",
'<img src="/static/img/defaultProfil.svg" type="image/svg+xml">' => "/user/view"
'<img src="/static/img/default_user.svg" type="image/svg+xml">' => "/user/view"
);
?>
<header>

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB