Skip to content

Commit 39a7355

Browse files
committed
fix float+int problem even better
1 parent abe349a commit 39a7355

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

codepoints.net/lib/Controller/OGImage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public function __invoke($match, Array $env) : string {
4646
'/<svg id="([^"]+(hk|jp|kr|sc|tc))" viewBox="([^"]+)"/',
4747
function($matches) use ($dbimage) {
4848
$xy = match($matches[2]) {
49-
'sc' => [0, 0],
50-
'tc' => [0, $dbimage['height'] / 2],
51-
'jp' => [$dbimage['width'] / 2, 0],
49+
'sc' => [ 0.0, 0.0],
50+
'tc' => [ 0.0, $dbimage['height'] / 2],
51+
'jp' => [$dbimage['width'] / 2, 0.0],
5252
'hk' => [$dbimage['width'] / 2, $dbimage['height'] / 2],
5353
'kr' => [$dbimage['width'] / 2, $dbimage['height'] / 2],
54-
default => [0, 0],
54+
default => [ 0.0, 0.0],
5555
};
5656
return sprintf('<text x="%s" y="%s" text-anchor="end" font-size="90" fill-opacity=".3333">%s</text><svg id="%s" width="%s" height="%s" transform="translate(%s, %s)" viewBox="%s"',
5757
$xy[0] + 500.0,

0 commit comments

Comments
 (0)