#100 Add SVG support for image and bgimage elements.
This commit is contained in:
parent
106fd9671e
commit
16b0f69acb
2 changed files with 13 additions and 2 deletions
|
@ -98,7 +98,12 @@ class element extends \customcertelement_image\element {
|
|||
$file->copy_content_to($location);
|
||||
|
||||
// Set the image to the size of the PDF page.
|
||||
$pdf->Image($location, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight());
|
||||
$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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,13 @@ 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);
|
||||
$pdf->Image($location, $this->element->posx, $this->element->posy, $imageinfo->width, $imageinfo->height);
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue