PHP Class JBZoo\Image\Text

Datei anzeigen Open project: JBZoo/Image Class Usage Examples

Protected Properties

Property Type Description
$_default

Public Methods

Method Description
render ( mixed $image, string $text, string $fFile, array $params = [] ) Add text to an image

Protected Methods

Method Description
_getColor ( mixed $image, string | array $colors ) : array Determine text color
_getStrokeX ( string $fontSize, integer $angle, string $fontFile, array $letters, string $charKey, integer $strokeSpacing, integer $textX ) : integer Get X offset for stroke rendering mode
_getTextboxSize ( string $fontSize, integer $angle, string $fontFile, string $text ) : array Determine textbox size
_render ( mixed $image, string $text, array $font, array $coords ) : array Compact args for imagettftext()
_renderStroke ( mixed $image, string $text, array $font, array $coords, array $stroke ) : array Same as imagettftext(), but allows for a stroke color and size

Method Details

_getColor() protected static method

Determine text color
protected static _getColor ( mixed $image, string | array $colors ) : array
$image mixed GD resource
$colors string | array
return array

_getStrokeX() protected static method

Get X offset for stroke rendering mode
protected static _getStrokeX ( string $fontSize, integer $angle, string $fontFile, array $letters, string $charKey, integer $strokeSpacing, integer $textX ) : integer
$fontSize string
$angle integer
$fontFile string
$letters array
$charKey string
$strokeSpacing integer
$textX integer
return integer

_getTextboxSize() protected static method

Determine textbox size
protected static _getTextboxSize ( string $fontSize, integer $angle, string $fontFile, string $text ) : array
$fontSize string
$angle integer
$fontFile string
$text string
return array

_render() protected static method

Compact args for imagettftext()
protected static _render ( mixed $image, string $text, array $font, array $coords ) : array
$image mixed A GD image object
$text string The text to output
$font array [$fontfile, $fontsize, $color, $angle]
$coords array [X,Y] Coordinate of the starting position
return array

_renderStroke() protected static method

Same as imagettftext(), but allows for a stroke color and size
protected static _renderStroke ( mixed $image, string $text, array $font, array $coords, array $stroke ) : array
$image mixed A GD image object
$text string The text to output
$font array [$fontfile, $fontsize, $color, $angle]
$coords array [X,Y] Coordinate of the starting position
$stroke array [$strokeSize, $strokeColor]
return array

render() public static method

Add text to an image
public static render ( mixed $image, string $text, string $fFile, array $params = [] )
$image mixed GD resource
$text string Some text to output on image as watermark
$fFile string TTF font file path
$params array Additional render params

Property Details

$_default protected_oe static_oe property

protected static $_default