Error when downloading certificate

tuthanh
Forums
I installed Opigno 2.10 on my local machine and make some sample courses. I completed one and tried to generate a certificate. The link is like: //localhost/drupal8/opigno/certificate/group/1/pdf It returned the 500 error: The website encountered an unexpected error. Please try again later. I checked the Drupal log, the issue is: Error: Class 'Svg\Document' not found in Dompdf\Helpers::dompdf_getimagesize() (line 620 of /opigno/profiles/opigno_lms/libraries/dompdf/src/Helpers.php) Do your guys know how to solve this problem? I am really appreciated it.
admin

Hi tuthanh,

Hi tuthanh,

 

As listed in the Opigno documentation, please go to the page  admin/reports/status/php and confirm allow_url_fopen is "On".

If it is not, please change this setting in your php configuration and restart any service necessary to activate the configuration change and go back to admin/reports/status/php to confirm.

Once that is done, that error should disappear.

 

Best regards

tuthanh

Hi admin,

Hi admin, Many thanks for your support. I checked the PHP status report, allow_url_fopen is set to ON. But the error is still there. Is there anything else that I should check? Thanks
admin

Hi tuthanh,

Hi tuthanh,

 

Are you using svg images?

Also, the images you added to the certificate, were they local images or images hosted somewhere else, outside the paltform?

 

Best regards

admin

Hi tuthanh,

Hi tuthanh,

That error comes from the dompdf library not being able to load the image on the server side for some reason and when that happens it runs some code that require other libraries. "Why cant i get these images? Is it because they are svg images"? and that triggers that error
To make those errors go away, you can add some additional libraries. Depending on how you installed opigno via composer or not you can do:

composer require phenx/php-font-lib:0.5.1 and composer require phenx/php-svg-lib:0.2

Or adding these libraries to the libraries folder if you did not use composer to install.

Adding these libraries will make the error go away but most probably the certificate will have not include the images. For some reason your webserver is not beeing able to load those images. These libraries should not be necessary if you are not using svg images. I suggest setting the web server folder permissions termporarly to 0777 recursivly and test again to check if its because of insuficient permissions on the server webserver user side.

 

Best regards