#80 Fixed user picture not displaying on PDF
This commit is contained in:
parent
041d49998e
commit
a0bb27773f
1 changed files with 12 additions and 13 deletions
|
@ -113,21 +113,20 @@ class element extends \mod_customcert\element {
|
||||||
|
|
||||||
$context = \context_user::instance($user->id);
|
$context = \context_user::instance($user->id);
|
||||||
|
|
||||||
// Prepare file record object.
|
// Get files in the user icon area.
|
||||||
$fileinfo = array(
|
|
||||||
'component' => 'user',
|
|
||||||
'filearea' => 'icon',
|
|
||||||
'itemid' => 0,
|
|
||||||
'contextid' => $context->id,
|
|
||||||
'filepath' => '/',
|
|
||||||
'filename' => 'f1.png');
|
|
||||||
|
|
||||||
// Get file.
|
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$file = $fs->get_file($fileinfo['contextid'], $fileinfo['component'], $fileinfo['filearea'],
|
$files = $fs->get_area_files($context->id, 'user', 'icon', 0);
|
||||||
$fileinfo['itemid'], $fileinfo['filepath'], $fileinfo['filename']);
|
|
||||||
|
|
||||||
// Show image.
|
// Get the file we want to display.
|
||||||
|
$file = null;
|
||||||
|
foreach ($files as $filefound) {
|
||||||
|
if (!$filefound->is_directory()) {
|
||||||
|
$file = $filefound;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show image if we found one.
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$contenthash = $file->get_contenthash();
|
$contenthash = $file->get_contenthash();
|
||||||
$l1 = $contenthash[0] . $contenthash[1];
|
$l1 = $contenthash[0] . $contenthash[1];
|
||||||
|
|
Loading…
Reference in a new issue