@@ -27,15 +27,15 @@ public function __invoke($match, Array $env) : string {
2727 header ('Cache-Control: public, max-age= ' .$ cache_duration );
2828 header ('Expires: ' .gmdate ('D, d M Y H:i:s \G\M\T ' , time () + $ cache_duration ));
2929
30- /** @var Array{width: int, height: int, image: string} */
30+ /** @var ? Array{width: int, height: int, image: string} */
3131 $ dbimage = $ env ['db ' ]->getOne ('SELECT width, height, image
3232 FROM codepoint_image
3333 WHERE cp = ? ' , get_printable_codepoint ($ cp ->id , $ cp ->gc ));
3434 if (! $ dbimage ) {
3535 http_response_code (404 );
3636 return '' ;
3737 }
38- $ svg = preg_replace (
38+ $ svg = ( string ) preg_replace (
3939 '/viewBox="[^"]+"/ ' ,
4040 sprintf ('viewBox="-50 0 %s %s" ' , $ dbimage ['width ' ] + 100 , $ dbimage ['height ' ] + 100 ),
4141 $ dbimage ['image ' ]);
@@ -58,7 +58,7 @@ public function __invoke($match, Array $env) : string {
5858 };
5959 $ svgimg ->blurImage ($ blur , $ blur );
6060 }
61- $ svgimg ->resizeImage ((int )ceil (min (400 , 400 * $ ratio )), (int )ceil (min (400 , 400 / $ ratio )), imagick::FILTER_LANCZOS , 1 );
61+ $ svgimg ->resizeImage ((int )ceil (min (400.0 , 400.0 * $ ratio )), (int )ceil (min (400.0 , 400.0 / $ ratio )), imagick::FILTER_LANCZOS , 1 );
6262 $ img ->compositeImage ($ svgimg , Imagick::COMPOSITE_DEFAULT , 50 + (int )((400 - $ svgimg ->getImageWidth ()) / 2 ), 50 );
6363
6464 $ name = case_cp_name ($ cp ->name );
0 commit comments