AnsPress_Avatar::image_center( resource|false $image, string $text, string $font, string $size, integer $angle = 8 )
Description #
Get center position on image.
Parameters #
- $imageresource | false (Required) Image resource.
- $textstring (Required) Text.
- $fontstring (Required) Font file path.
- $sizestring (Required) Size of image.
- $angleinteger (Optional) Angle. Default value: 8
Source #
File: addons/free/avatar.php
protected function image_center( $image, $text, $font, $size, $angle = 8 ) { $xi = imagesx( $image ); $yi = imagesy( $image ); $box = imagettfbbox( $size, $angle, $font, $text ); $xr = abs( max( $box[2], $box[4] ) ); $yr = abs( max( $box[5], $box[7] ) ); $x = intval( ( $xi - $xr ) / 2 ); $y = intval( ( $yi + $yr ) / 2 ); return array( $x, $y ); }
Expand full source code Collapse full source code View on GitHub: addons/free/avatar.php:411
Add your comment