@@ -53,6 +53,7 @@ function formatSpeedtestDataForImage($speedtest)
5353 $ speedtest ['ul ' ] = format ($ speedtest ['ul ' ]);
5454 $ speedtest ['ping ' ] = format ($ speedtest ['ping ' ]);
5555 $ speedtest ['jit ' ] = format ($ speedtest ['jitter ' ]);
56+ $ speedtest ['timestamp ' ] = $ speedtest ['timestamp ' ];
5657
5758 $ ispinfo = json_decode ($ speedtest ['ispinfo ' ], true )['processedString ' ];
5859 $ dash = strpos ($ ispinfo , '- ' );
@@ -85,6 +86,7 @@ function drawImage($speedtest)
8586 $ ping = $ data ['ping ' ];
8687 $ jit = $ data ['jitter ' ];
8788 $ ispinfo = $ data ['ispinfo ' ];
89+ $ timestamp = $ data ['timestamp ' ];
8890
8991 // initialize the image
9092 $ SCALE = 1.25 ;
@@ -110,6 +112,9 @@ function drawImage($speedtest)
110112 $ FONT_ISP = tryFont ('OpenSans-Semibold ' );
111113 $ FONT_ISP_SIZE = 9 * $ SCALE ;
112114
115+ $ FONT_TIMESTAMP = tryFont ("OpenSans-Light " );
116+ $ FONT_TIMESTAMP_SIZE = 8 * $ SCALE ;
117+
113118 $ FONT_WATERMARK = tryFont ('OpenSans-Light ' );
114119 $ FONT_WATERMARK_SIZE = 8 * $ SCALE ;
115120
@@ -122,6 +127,7 @@ function drawImage($speedtest)
122127 $ TEXT_COLOR_MEASURE = imagecolorallocate ($ im , 40 , 40 , 40 );
123128 $ TEXT_COLOR_ISP = imagecolorallocate ($ im , 40 , 40 , 40 );
124129 $ SEPARATOR_COLOR = imagecolorallocate ($ im , 192 , 192 , 192 );
130+ $ TEXT_COLOR_TIMESTAMP = imagecolorallocate ($ im , 160 , 160 , 160 );
125131 $ TEXT_COLOR_WATERMARK = imagecolorallocate ($ im , 160 , 160 , 160 );
126132
127133 // configure positioning or the different parts on the image
@@ -150,6 +156,9 @@ function drawImage($speedtest)
150156
151157 $ SEPARATOR_Y = 211 * $ SCALE ;
152158
159+ $ POSITION_X_TIMESTAMP = 4 * $ SCALE ;
160+ $ POSITION_Y_TIMESTAMP = 223 * $ SCALE ;
161+
153162 $ POSITION_Y_WATERMARK = 223 * $ SCALE ;
154163
155164 // configure labels
@@ -197,6 +206,8 @@ function drawImage($speedtest)
197206 imagefttext ($ im , $ FONT_ISP_SIZE , 0 , $ POSITION_X_ISP , $ POSITION_Y_ISP , $ TEXT_COLOR_ISP , $ FONT_ISP , $ ispinfo );
198207 // separator
199208 imagefilledrectangle ($ im , 0 , $ SEPARATOR_Y , $ WIDTH , $ SEPARATOR_Y , $ SEPARATOR_COLOR );
209+ // timestamp
210+ imagefttext ($ im , $ FONT_TIMESTAMP_SIZE , 0 , $ POSITION_X_TIMESTAMP , $ POSITION_Y_TIMESTAMP , $ TEXT_COLOR_TIMESTAMP , $ FONT_TIMESTAMP , $ timestamp );
200211 // watermark
201212 imagefttext ($ im , $ FONT_WATERMARK_SIZE , 0 , $ POSITION_X_WATERMARK , $ POSITION_Y_WATERMARK , $ TEXT_COLOR_WATERMARK , $ FONT_WATERMARK , $ WATERMARK_TEXT );
202213
0 commit comments