根据所选图像Moodle添加文字

In my Certificate plugin in Moodle, I can choose from 4 signatures. The signature images are shown in the certificate and loaded trough CERT_IMAGE_SIGNATURE:

certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', '');

The file names are jacob.png vanessa.png stan.png `lilly.png.

How to add automatically text under the image? For example the names of the person from the signature image?

If I choose the file jacob.png from the dropdown list, It should load under the image also the names, here "Jacob Svenson".

I would do something like this

in /mod/certificate/type/xxx/certificate.php

if (!empty($certificate->printsignature)) {
    certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', '');
    $signame = get_string($certificate->printsignature, 'certificate');
    certificate_print_text($pdf, $x, $y + 20, 'C', $fontserif, '', 20, $signame);
}

and in /mod/certificate/lang/en/certificate.php use the file name as the string id.

$string['jacob.png'] = 'Jacob Svenson';