From 34a239a823ffdea8b6dac04b5471d0e0bcb74179 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 13 Aug 2025 14:54:43 +0200 Subject: [PATCH 1/2] Set Foto to null instead of empty String when Deleted --- application/controllers/api/frontend/v1/stv/Student.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index ac09f39bb..70970d8b5 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -276,9 +276,14 @@ 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) + { $update_person[$prop] = $val; } + if($prop == 'foto' && $val == '') + { + $update_person[$prop] = null; + } } $array_allowed_props_student = ['matrikelnr']; From 0df9cf769fd7a27528fe7b2534fce82dcb9f05e6 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Fri, 26 Sep 2025 14:33:20 +0200 Subject: [PATCH 2/2] strip data image base64 prefix before storing foto, show dummy profile img when foto is null in DetailsHeader --- .../controllers/api/frontend/v1/stv/Student.php | 15 ++++++++++----- public/js/components/DetailHeader/DetailHeader.js | 9 ++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 90c12fe41..f2845572f 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -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']; diff --git a/public/js/components/DetailHeader/DetailHeader.js b/public/js/components/DetailHeader/DetailHeader.js index 5c1573753..1088e3f63 100644 --- a/public/js/components/DetailHeader/DetailHeader.js +++ b/public/js/components/DetailHeader/DetailHeader.js @@ -102,6 +102,13 @@ export default { redirectToLeitung(){ this.$emit('redirectToLeitung', { person_id: this.leitungData.person_id}); + }, + getFotoSrc(foto) { + if(foto === null) { + return FHC_JS_DATA_STORAGE_OBJECT.app_root + 'skin/images/profilbild_dummy.jpg'; + } else { + return 'data:image/jpeg;base64,' + foto; + } } }, template: ` @@ -116,7 +123,7 @@ export default { Profilbild