Search code examples
phpmoodlemoodle-api

Moodle change badges image size


when I create a badge in Moodle 3.5, the core automatically creates 3 thumbs for the badge icon (35x35, 100x100, 512x512). I should increase the size of the 100x100 thumb, but that size are hardcoded in the core package: /lib/gdlib.php, function process_new_icon() lines 184,214,228.

What's the better way to achieve my purpose without hacking the core files? Maybe a local plugin would be able to override a core's function?

Thanks


Solution

    1. Create a plugin. Write the same function (use classes folder with your own class, it is autoloaded), but with variative width.

    2. Find the script that creates badges. Use customscripts functionality to replace script with your own, which uses your newly created function.