Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 6 |
| SvgImageHelper | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
| holder | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| <?php | |
| namespace common\helpers; | |
| abstract class SvgImageHelper | |
| { | |
| public static function holder($text, $width, $height) | |
| { | |
| $lines = explode("\n", $text); | |
| $svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.$width.' '.$height.'" preserveAspectRatio="none meet" width="'.$width.'" height="'.$height.'"><defs /><rect fill="#eeeeee" width="'.$width.'" height="'.$height.'" /><g><text style="font-family: Arial, Helvetica, Open Sans, sans-serif, monospace; font-size: 10pt; font-weight: bold; dominant-baseline: central; fill: #aaaaaa; text-align: center;" x="50%" y="70" text-anchor="middle">'.$text.'</text></g></svg>'; | |
| $base64 = base64_encode($svg); | |
| return 'data:image/svg+xml;base64,'.$base64; | |
| } | |
| } |