Generator::image_center( GdImage|false $image, string $text, string $font, string $size, integer $angle = 8 )
Description #
Get center position on image.
Parameters #
- $imageGdImage | 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/avatar/class-generator.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/avatar/class-generator.php:273
Add your comment