/** * output the player online image */ public function outputCurrentPlayerImage() { $playerNumber = $this->getCurrentPlayer(); $image = imagecreate(250, 50); //set the background color of the image $color = $this->collectionOptions->getGeneralOptions()->getImagePlayer()['background_color']; imagecolorallocate($image, $color[0], $color[1], $color[2]); //set the color for the text $color = $this->collectionOptions->getGeneralOptions()->getImagePlayer()['font_color']; $fontColor = imagecolorallocate($image, $color[0], $color[1], $color[2]); //adf the string to the image $maxPlayer = $this->collectionOptions->getGeneralOptions()->getMaxPlayer(); if ($maxPlayer > 0) { $text = sprintf('%s/%s Player Online', $playerNumber, $maxPlayer); } else { $text = sprintf('%s Player Online', $playerNumber); } $this->imageCenterString($image, 5, $text, $fontColor); imagepng($image); imagedestroy($image); }