forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from dkloepfer/4_4_gev_ta
ILIAS-eLearning#2392 svg and pdf creation
- Loading branch information
Showing
3 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...rvices/Repository/RepositoryObject/TalentAssessment/classes/Observations/SVGConverter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
namespace CaT\Plugins\TalentAssessment\Observations; | ||
require_once 'Services/Utilities/classes/class.ilUtil.php'; | ||
|
||
class SVGConverter { | ||
public function __construct($img_markup_string) { | ||
$this->img = $img_markup_string; | ||
} | ||
|
||
public function ConvertAndReturnPath($format = 'png24') { | ||
$svg_file_h = tmpfile(); | ||
$png_file_h = tmpfile(); | ||
fwrite($svg_file_h, $this->img); | ||
$svg_filename = stream_get_meta_data($svg_file_h)['uri']; | ||
rename($svg_filename, $svg_filename.'.svg'); | ||
$png_filename = stream_get_meta_data($png_file_h)['uri']; | ||
\ilUtil::convertImage($svg_filename.'.svg', $png_filename, $format); | ||
rename($svg_filename.'.svg', $svg_filename); | ||
rename($png_filename, $png_filename.'.png'); | ||
$png_filename .= '.png'; | ||
return $png_filename; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.