PHP Classes

Smart String: Reformat text string to render within a box

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 94 All time: 9,880 This week: 524Up
Version License PHP version Categories
smart-string 1.0.0The PHP License5PHP 5, Graphics, Text processing
Description 

Author

This class can reformat text string to render within a box.

It can take a given text string and formats it so it can be rendered as graphics that fit within a box of a given width.

The class can use a giver TrueType font to test if the text fits within the given dimensions.

Picture of Roni
  Performance   Level  
Name: Roni is available for providing paid consulting. Contact Roni .
Classes: 12 packages by
Country: Bangladesh Bangladesh
Age: ???
All time rank: 279535 in Bangladesh Bangladesh
Week rank: 307 Up6 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php
include_once "lib/SmartString.php";

$text = "I reworked the feed reading signature images I made a while back and added something to trim the strings to a decent length without breaking words. So here you go. A one-liner that will ";

$str = new SmartString("This&nbsp;&nbsp;is &nbsp; &nbsp; a smart string with random words for testing", array(
   
'font_name' => 'arial',
    ));

$str2 = new SmartString($text,array(
   
'line_width'=>45,
));

echo
$str->type('width')->limit(100).PHP_EOL."<br>";
echo
$str2->type('line')->limit(3);


Details

smart-string

Php String Manipulation Class


  Files folder image Files  
File Role Description
Files folder imagelib (1 file)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  lib  
File Role Description
  Plain text file SmartString.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:94
This week:0
All time:9,880
This week:524Up