Get the App
SLTechnology News&Howtos  ›  Development  › 

How to get the width and height of a text display Lattice by PHP

Shulou Source: shulou.com Published: 2022-06-03 19:46:48 10月01日 Update

This article mainly shows you how to get a paragraph of text display lattice width and height PHP, simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn about "PHP how to get a paragraph of text display lattice width and height" this article bar.

The details are as follows:

define ("F_SIZE", 8);define ("F_FONT", "arial.ttf");function get_bbox($text){ return imagettfbbox (F_SIZE, 0, F_FONT, $text);}function text_height ($text) { $box = get_bbox($text); $height = $box[3] - $box[5]; return $height;}function text_width ($text) { $box = get_bbox($text);$width = $box[4] - $box[6]; return $width;} The above is "How to get a text display dot width and height in PHP" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Width text lattice height content articles learning help easy to understand more organization knowledge editing industry information information channels channels research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Huawei OPPO Reno macOS NVidia