Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




Back to articles

Generate text using images as letters

Image Font class can generate text taking images of symbols as font.

You can provide path to directory with images, using symbols as file names, or you can provide and array with symbols as keys and paths to images as values

It is also possible to set a maximal width restriction and alignment of text.

Contents

Download

Example codes

<?php

//create class instance provided path to images
include("image_font.php");
$imf = new image_font("./digits/");

//provide text
$imf->apply_font("26056123");

//output image to browser
$imf->output();

?>

Examples in action

Example scripts provided with package in action:

Method list

Create instance

Back to method list

Method namenew image_font($source)
Description

Create class instance

Input parametersstring or array $source - the source of images as array of values with symbols as keys or path to directory, where file names are symbols

Set source for images

Back to method list

Method nameset_source($source)
DescriptionSet source where to take images for text
Input parametersstring or array $source - the source of images as array of values with symbols as keys or path to directory, where file names are symbols

Set width of space symbol

Back to method list

Method nameset_space($px)
DescriptionSet width of space symbol
Input parametersint $px - width of space in pixels

Set Letter spacing

Back to method list

Method nameset_letter_spacing($px)
DescriptionSet width of space between symbols
Input parametersint $px - width of space between symbols

Set Line spacing

Back to method list

Method nameset_line_spacing($px)
DescriptionSet width of space between lines
Input parametersint $px - width of space between lines

Set File Extension

Back to method list

Method nameset_extension($ext)
DescriptionSet extension of file that will be used as letters and as image output extension
Input parametersstring $ext - name of extension

Set Text

Back to method list

Method nameapply_font($text, $align = "left", $max = 0)
DescriptionSet text to write with image font
Input parameters

string $text - text to write with images

string $align - alignment of text, possible values: left, right, center, justify

int $max - width restriction for text in pixels, 0 equals no restriction

Get Width

Back to method list

Method nameget_width()
DescriptionGet width of image

Get Height

Back to method list

Method nameget_height()
DescriptionGet height of image

Output Image to Browser

Back to method list

Method nameoutput()
DescriptionOutput image directly to browser

Force Download

Back to method list

Method namedownload($name = "default")
DescriptionForce download of file
Input parametersstring $name - name of file to force download

Save Image

Back to method list

Method namesave($filename)
DescriptionSave file to a specified location with specified file name
Input parametersstring $filename - path and name of file where to save it

Awards

Image Font class was nominated to Innovation Award and achieved 1st place, thanks everyone for support

Latest changes

None for now


You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus