PHP Classes

Pure PHP Text Render: Render text in an image in pure PHP

Recommend this page to a friend!
  Info   Example   Demos   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 56%Total: 624 All time: 5,065 This week: 89Up
Version License PHP version Categories
pure-text-render 1.0GNU Lesser Genera...4.0PHP 5, Graphics, Text processing
Description 

Author

This class can render text in an image in pure PHP.

It can create an image rendering a given text in it. The text may have line break characters to split the text in multiple lines.

The class contains the definition the bitmaps of each character of the supported built-in font.

The rendered text can be scaled or rotated.

The image can be saved in BMP format without using the GD or any PHP image extension.

Innovation Award
PHP Programming Innovation award nominee
August 2014
Number 2


Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
PHP can used the GD extension to create images with text rendered on them. However, sometimes it is not possible to use the GD extension for some reason.

This class provides an alternative solution for creating images with text using pure PHP code that does not use the GD extension.

Manuel Lemos
Picture of Abius X
  Performance   Level  
Name: Abius X is available for providing paid consulting. Contact Abius X .
Classes: 4 packages by
Country: Iran Iran
Age: 36
All time rank: 114710 in Iran Iran
Week rank: 197 Up2 in Iran Iran Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Example

<?php
require_once __DIR__."/pure_text_render.php";
$obj=new PureTextRender();
$text="Hello there people!".PHP_EOL."This is rendered using only PHP...";
$bitmap=$obj->text_bitmap($text);
$size=$obj->text_size($text);
list(
$rotated,$size[0],$size[1])=$obj->rotate_bitmap($bitmap,$size[0],$size[1],10);
$obj->display_bitmap($size[0],$size[1],$rotated);


  Online SampleExternal page  

Open in a separate window

Screenshots (4)  
  • captcha.jpg
  • rotated.jpg
  • screenshot1.png
  • screenshot2.png
  Files folder image Files (10)  
File Role Description
Plain text file pure_text_render.php Class main class file
Accessible without login Image file captcha1.bmp Output sample generated CAPTCHA
Accessible without login Image file captcha2.bmp Output sample generated CAPTCHA
Accessible without login Plain text file example.php Example sample usages
Accessible without login Plain text file example_captcha.php Example PureCaptcha Example
Plain text file pure_captcha.php Class Generate Nice Pure Captchas Using PureTextRender

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:624
This week:0
All time:5,065
This week:89Up
User Ratings User Comments (1)
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:81%StarStarStarStarStar
Tests:-
Videos:-
Overall:56%StarStarStar
Rank:1740
 
very good
10 years ago (hassan ahmadi)
70%StarStarStarStar