Advanced search  

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

Pages: [1]   Go Down

Author Topic: Defining the length of a comment in thumbnail view  (Read 2195 times)

0 Members and 1 Guest are viewing this topic.

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Defining the length of a comment in thumbnail view
« on: September 23, 2006, 04:24:44 pm »

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 :

Code: [Select]
strlen($row['msg_body'])

But to process the smileys we would use ater this

Code: [Select]
$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

Code: [Select]
$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
« Last Edit: September 23, 2006, 04:29:56 pm by xplicit »
Logged
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.
Pages: [1]   Go Up
 

Page created in 0.015 seconds with 20 queries.