Layer text
layer:otext
, layer:utext
Writing a text on an image (otext
) and writing a text under the base image (utext
).
Aliases
layer:ut
layer:ot
Structure
layer:<utext|otext>::<text>
layer:<utext|otext>:<parameter 1>,<paramater N>:<text>
layer:<utext|otext>:<parameter 1>,<parameter 2>:<parameter 2 subparameter>:<text>
Parameters
The order of the parameters are optional, and you can separate the parameters with the character ,
.
- font weight (weight):
- specifications:
thin
,light
,normal
,medium
,bold
,black
- values:
w100
,w200
,w300
,w400
,w500
,w600
,w700
,w800
,w900
- default:
w400
- specifications:
- decoration: (you can only use one at a time)
- underline:
unl
,underline
- overline:
ovl
,overline
- strikethrough:
str
,strike
- underline:
- font size [px]
s:
+ font size [px], e.g.s:20
- default: 16
- space:
ws:
+ space[px]
- line spacing:
lines:
+ line spacing[px]
- alignment:
align:
left
,right
,center
- style
italic
,oblique
- word wrap
wrap
: break long words into multiple rows
- outline color
storke-color:
+ color (the format identical to thecolor
operation)- alias:
sc
- default:
black
- if the outline width is specified
- outline width
stroke-width:
+ width [px], e.g.stroke-width:3
- alias:
sw
- text encoding
b64
: BASE64 encoded; this is recommended if you have other characters than the ones in the ASCII characters
- font family
aclonica
,droidsans
,exo
,justanotherhand
,montez
,opensans
,roboto
,tinos
,yellowtail
,xiaowei
(Chinese characters are supported),shekari
(Arabic characters are supported),BrushHandNew
(Brush Hand New),CaptureSmallz
(Capture Smallz),CaptureSmallzClean
(Capture Smallz Clean),dLaCruz
(d La Cruz),Everything
(Everything),IndianaJonas48
(Indiana Jonas 48),JustTellMeWhatVersion2
(Just Tell Me What (Version 2)),KGHappy
(KG Happy),KGHappyShadows
(KG Happy Shadows),KGHappySolid
(KG Happy Solid),KGMissKindergarten
(KG Miss Kindergarten),MFCandy
(MF Candy),MFPlexus
(M.F. Plexus),NaturalBeautyPersonalUse
(Natural Beauty Personal Use),Optien
(Optien),PressStart2P
(Press Start 2P),Pricedown
(Pricedown),RidinDirty
(Ridin Dirty),VeteranTypewriter
(Veteran Typewriter),WatermelonScriptDemo
(Watermelon Script Demo),Montserrat
(Montserrat)
- Google Fonts
gf:
+URL encoded string e.g. gf:Montserrat
- NOP - No operation
nop
no operation
Limitations
- This transformation does not have any limitations.
Dependencies
Examples
Overlayer text on the top
w:400/g:t_co:fffa_l:otext:bold,s:40:The crowd is loud!
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(400)->group()->gTop()->color('fffa')->textOverlay('bold,s:40:The crowd is loud!');
Overlayer text on the bottom left
w:400/x:10_g:bl_co:fffe_l:otext:w100,s:30:The crowd is loud!
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(400)->group()->x(10)->gBottomLeft()->color('fffe')->textOverlay('w100,s:30:The crowd is loud!');
Overlayer text on the bottom right
w:400/x:10_g:br_co:0003_l:otext:s:40,sw:1.5,sc:fffa:The crowd is loud!
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(400)->group()->x(10)->gBottomRight()->color('0003')->textOverlay('s:40,sw:1.5,sc:fffa:The crowd is loud!');
Overlayer text in the center
w:400/co:red_l:otext:s:80:In%20cofe/e:blur:200_r:30_e:px:4/l:end
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(400)->group()->color('red')->textOverlay('s:80:In%20cofe')->group()->blur(200)->rotateCW(30)->pixelate(4)->end();
Overlayer text on the top right
w:400/x:10_g:tr_co:0003_l:otext:s:40,b64,sw:1.5,sc:fffa:VGhlIGNyb3dkIGlzIGxvdWQh
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(400)->group()->x(10)->gTopRight()->color('0003')->textOverlay('s:40,b64,sw:1.5,sc:fffa:VGhlIGNyb3dkIGlzIGxvdWQh');
Overlayer text with google fonts
w:400/g:t_co:fffa_l:otext:gf:Pacifico,s:40:The crowd is loud!
use shardimage\shardimagephp\factories\Text;
use shardimage\shardimagephp\factories\Transformation;
$text = (Text::create("The crowd is loud!"))->googleFonts('Pacifico')->size(40);
$transformations = (new Transformation())->width(400)->group()->gTop()->color('fffa')->textOverlay($text);