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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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.