#100 Add SVG support for image and bgimage elements.
This commit is contained in:
parent
408da87cb3
commit
d2fc041038
2 changed files with 13 additions and 2 deletions
|
@ -98,9 +98,14 @@ class element extends \customcertelement_image\element {
|
|||
$file->copy_content_to($location);
|
||||
|
||||
// Set the image to the size of the PDF page.
|
||||
$mimetype = $file->get_mimetype();
|
||||
if ($mimetype == 'image/svg+xml') {
|
||||
$pdf->ImageSVG($location, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight());
|
||||
} else {
|
||||
$pdf->Image($location, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the element in html.
|
||||
|
|
|
@ -173,9 +173,15 @@ class element extends \mod_customcert\element {
|
|||
if ($file = $fs->get_file_by_hash($imageinfo->pathnamehash)) {
|
||||
$location = make_request_directory() . '/target';
|
||||
$file->copy_content_to($location);
|
||||
|
||||
$mimetype = $file->get_mimetype();
|
||||
if ($mimetype == 'image/svg+xml') {
|
||||
$pdf->ImageSVG($location, $this->element->posx, $this->element->posy, $imageinfo->width, $imageinfo->height);
|
||||
} else {
|
||||
$pdf->Image($location, $this->element->posx, $this->element->posy, $imageinfo->width, $imageinfo->height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the element in html.
|
||||
|
|
Loading…
Reference in a new issue