Defining the length of a comment in thumbnail view Defining the length of a comment in thumbnail view
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Defining the length of a comment in thumbnail view

Started by xplicit, September 23, 2006, 04:24:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xplicit

I am puzzling how to solve the following situation

When your viewing comments in thumbnails, it can mess up the layout if it contains smillies. Especially if people place commetns only containing a row of smilies.

It's easy to define the length of a pure text string using :

strlen($row['msg_body'])

But to process the smileys we would use ater this

$msg_body = process_smilies($msg_body);

There is a way to determine the size of a smiley using the standard php function getimagesize()

but how to combine these functions so you can determine the lenght of the complete string.

In my case I want comments including the smileys in thumbnail view on 1 line (maximum) for lets say 150 px width and not spread over more lines so I can cut it off at 50 and place .... after it

$msg_body = utf_strlen($msg_body) > 50 ? utf_substr($msg_body,0,50).'...': $msg_body;


But I got two different unitys (px and tekst lenght) so there must be a trick to combine these.

further more I would like to get rid of half processed emoticons (for instance :brea instead of the full emotion which would use :break: ). if it breaks the string. But I think I can program this by checking for the last word in the original string at for instance 50, by searching for a white space in front and at the end of the last word and process this individual to check if it's an emoticon or not. But still this would include another emoticon width problem.

I'm a pretty good php programmer and know my way around in coppermine almost blindly so I don't need a complete written solution (although it would be appriciated) not but more a pointing in the right direction how to tackle this problem
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.