- $length=strlen($link['title'])+strlen($link['description']);
- if ($link['thumbnail']) $length +=100; // 1 thumbnails roughly take as much space as 100 words;
-
+ // Title: 30 chars = 1 line. 1 line is 30 pixels height.
+ // Description: 836 characters gives roughly 342 pixel height.
+ // This is not perfect, but it's usually ok.
+ $length=strlen($link['title'])+(342*strlen($link['description']))/836;
+ if ($link['thumbnail']) $length +=100; // 1 thumbnails roughly takes 100 pixels height.