Keys →
Functions ↓
function dimTextBox ( $text, $fontFile, $fontSize, $fontAngle=0, $fontScale=1 ) {#-k text font format#- simple function that calculates the displayed size of a string.#- The function returns an associative array with these keys:#- left, top: coordinates you will pass to imagettftext#- width, height: dimension of the image you have to create $rect = imagettfbbox ( $fontSize, $fontAngle, $fontFile, $text ); $minX = min(array ( $rect[0], $rect[2], $rect[4], $rect[6] )); $maxX = max(array ( $rect[0], $rect[2], $rect[4], $rect[6] )); $minY = min(array ( $rect[1], $rect[3], $rect[5], $rect[7] )); $maxY = max(array ( $rect[1], $rect[3], $rect[5], $rect[7] )); return array ( "x" => ceil(abs($minX)*$fontScale) - 1, "y" => ceil(abs($minY)*$fontScale) - 1, "w" => ceil(($maxX - $minX)*$fontScale), "h" => ceil(($maxY - $minY)*$fontScale), "b" => $rect ); }?>