Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $text = "Hello World!";
- $image = new Imagick();
- $draw = new ImagickDraw();
- $color = new ImagickPixel('#f00');
- $draw->setFontSize(50);
- $draw->setFillColor($color);
- $draw->setStrokeAntialias(true);
- $draw->setTextAntialias(true);
- $metrics = $image->queryFontMetrics($draw, $text, false);
- echo $metrics['textWidth'];
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement