PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 622 All time: 5,068 This week: 325Up
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: 114810 in Iran Iran
Week rank: 312 Up8 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  
  • captcha.jpg
  • rotated.jpg
  • screenshot1.png
  • screenshot2.png
  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:622
This week:0
All time:5,068
This week:325Up
User Ratings User Comments (1)
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:742
 
very good
9 years ago (hassan ahmadi)
70%StarStarStarStar