Adding Students photo

Good day,
It has been a while since I last asked for help, but this one has me really stuck. I followed the instructions as it pertains to uploading students pictures and I had some success zipping the pictures and uploading them, but I can not find the said pictures to add to the student profiles, Please help.

Hello, long time no see! The import process uploads the zip file, unzips it, and then uses the name of the file to find the user, before attaching the photo to them. In this way, you don’t need to do anything after import, the photos should just appear when you view the student. Hope this helps. Ross.

We have two students have same first name such as Edward Smith and Edward Stone. While I uploaded their photos, the uploaded photo files were all changed by system to Edward.jpg. The second Edward.jpg file overrode first Edward.jpg that was uploaded previously. Then both students had the same pictures. How can I fix this problem?

Hi tlee, was this bulk importing the photos, or uploading the photo for an individual student? I’ve not seen this bug before, and wondering if it was something introduced in v15 in the big interface form rewrite we did.

The photos were uploading for individual student. The system renamed the attached file by itself to the same file name that is student’s Preferred_Name.jpg (edward.jpg). It worked fine, if students have different Preferred Name. I did change their preferred names (EdwardSt and EdwardSm) and then uploaded their photos again but the system still renamed the file name to the original Preferred_Name.jpg (edward.jpg).

Hello, when adding or editing individual students, the file is named with the student’s username, which should be unique. You can see this on line 257 of user_manage_addProcess.php and 405 of user_manage_editProcess.php. As such the preferred name should not have an impact.

The username is unique. One username is Edward.Smith and the other one is Edward.Stone but when the photos were uploading for individual student, the attached file name all became edward.jpg. Therefore the last photo will replace the previous photo.

Right, that is interesting! I’ve spoken to @ross and she has a fix to this bug, which is not one we had seen before. It comes down to the way that usernames with full stops in them are handled in file uploads. She is just preparing a PR, and I will accept it into the system and post the commit link here. Thanks for your patience whilst we look into it.

OK, the fix is in place in v16, via the commit linked below:

https://github.com/GibbonEdu/core/commit/27d86afabb84a949fb031fc9c9706c63dfe3723b

To apply this to v15, you can find the file src/Gibbon/FileUploader.php, go to line 219 and replace mb_strpos with mb_strrpos (they look similar, but the extra r is important!).

Thanks to @ross for the fix.

Cheers, Ross

It works. Thanks.

Good day, I have followed the instructions as it concerns the uploading of the pictures, i.e I have resized the pictures to the recommended size, saved in the correct format , zipped and uploaded and still I cannot see the students photos on their profile. When I try to import the pictures individually the system locks up and the display turns white. I have to close the tab that is open and re-open another tab just to get back to the database.

PLEASE HELP!

Hmm, that sounds odd. I wonder if the uploads folder is system writeable? If you go to System Admin > System Check, at the bottom it’ll check the permissions of the folder for you & let you know. It’ll also check to see if there’s any PHP extensions missing, like gd.

Otherwise, when bulk-uploading the photos, did the system say everything was successful & then no change? The system locking up is quite unusual, does this happen with other types of file upload (eg: Birth Certificate Scan/Password Scan), or only with the user photos?

I checked and the PHP extension gd is missing, so I added it. The upload folder permission is set correctly. The problem remains the same

Hi nosaj1705,

After uploading a picture (and it failing), can you check your PHP error log to see if there’s any other errors that may shed light on what’s happening. These can be located in different places depending on your system (eg: for an Ubuntu + Apache system it’s often an error.log file in /var/log/apache2)