protected static function _getTextboxSize($fontSize, $angle, $fontFile, $text) { // Determine textbox size $fontPath = FS::clean($fontFile); if (!FS::isFile($fontPath)) { throw new Exception('Unable to load font: ' . $fontFile); } $box = imagettfbbox($fontSize, $angle, $fontFile, $text); $boxWidth = abs($box[6] - $box[2]); $boxHeight = abs($box[7] - $box[1]); return array($boxWidth, $boxHeight); }