gd (1)

Smart text trimming with PHP

Have you ever tried to create a short preview text using PHP? Did you just count the characters and ended up having texts with a completely different width like shown on this picture?


This tutorial describes a small method which calculates the real width of a string and lets you create better looking preview texts!