strip data image base64 prefix before storing foto, show dummy profile img when foto is null in DetailsHeader

This commit is contained in:
Harald Bamberger
2025-09-26 14:33:20 +02:00
parent 464b99b3f9
commit 0df9cf769f
2 changed files with 18 additions and 6 deletions
@@ -276,14 +276,19 @@ class Student extends FHCAPI_Controller
$update_person = array();
foreach ($array_allowed_props_person as $prop) {
$val = $this->input->post($prop);
if ($val !== null)
if ($val === null)
{
continue;
}
if($prop == 'foto')
{
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
$update_person[$prop] = $fotoval;
}
else
{
$update_person[$prop] = $val;
}
if($prop == 'foto' && $val == '')
{
$update_person[$prop] = null;
}
}
$array_allowed_props_student = ['matrikelnr'];