Merge pull request #67 from ThomasRubini/img
This commit is contained in:
commit
7bcd774c07
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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"];
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
BIN
static/img/default_recipe.jpg
Normal file
BIN
static/img/default_recipe.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
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 |
Loading…
Reference in New Issue
Block a user