2017 © Pedro PelÃĄez
 

library texter

A PHP class which makes it easier to write Bangla text on images. Supports multi-line, align etc.

image

nazmulpcc/texter

A PHP class which makes it easier to write Bangla text on images. Supports multi-line, align etc.

  • Monday, January 29, 2018
  • by nazmulpcc
  • Repository
  • 2 Watchers
  • 6 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Texter

Texter helps to write Bangla/English text on image with PHP GD. It also has featurs like align, maintain lineheight, color settings etc., (*1)

Example

    $texter = new nazmulpcc\Texter;
    $image = imagecreate(500, 300);
    imagecolorallocate($image, 255, 255, 255);
    $texter->startFrom(50, 90)->width(400)->on($image)->align('center')->fontSize(30)->color('333333');
    $texter->text('āφāĻŽāĻžāϰ āϏ⧋āύāĻžāϰ āĻŦāĻžāĻ‚āϞāĻž, āφāĻŽāĻŋ āϤ⧋āĻŽāĻžā§Ÿ āĻ­āĻžāϞāĻŦāĻžāϏāĻŋ Lorem ipsum dolor sit amet.....')->write();

It will give you something like this: Result, (*2)

Installation

You can easily install Texter via composer or you can manually download the package and include them in your code., (*3)

Composer

    composer require nazmulpcc/Texter

Manual

  • Download/Clone this repo.
  • Download/Clone mirazmac/Unicode2Bijoy .
  • Include Texter.php and Unicode2Bijoy.php in your code and you are ready to go.

Documentation

Each method is fairly well documented in the source code. A few important methods:
- startFrom(x, y): Set up the co-ordinates from which Texter will start writing.
- width($w): Width of the boundary inside which Texter will write text.
- align($position): Set the horizontal alignment to left, right or center/centre. Default is left.
- on($image) / image($image): Set the image on which Texter will write. Image is passed by reference.
- fontSize($size): Set the font size. $size can be point or pixel, like $texter->fontSize('15pt') or $texter->fontSize('15px'). If 'pt' or 'px' is absent, the gd default is used.
- color($hex): / color($red, $green, $blue): Both hex and RGB are accepted as text color. - text($text): Add text to be written.
- lineHeight($height): The line height. $height can be in pixel or as a percentage of the text height.
- write(): Call this guy to do the job or if you want to start a new line.
All public functions can be chained up. So you can always do things like:, (*4)

    $texter->startFrom(10, 10)
                ->color(0, 0, 0)
                ->align('center')
                ->width(500)
                ->text('Hellow World')
                ->write();

Note: Before you write a piece of text, you must at least set the starting points(startFrom), width, and image., (*5)

About Texter

I developed this out of pure frustration that PHP, one of the most widely used coding language doesn't support Bangla because GD can't handle complex fonts. There are room for a lot of improvements which I will try to accomplish gradually. Please contribute if you can., (*6)

To-Do

  • Add vertical alignment feature.
  • Support for Text shadow.
  • Add some debugging functions etc.

License

This project is lincensed under DBAD license., (*7)

The Versions

29/01 2018

dev-master

9999999-dev

A PHP class which makes it easier to write Bangla text on images. Supports multi-line, align etc.

  Sources   Download

dbad

The Requires

 

by Nazmul Alam

01/03 2017

1.0

1.0.0.0

A PHP class which makes it easier to write Bangla text on images. Supports multi-line, align etc.

  Sources   Download

dbad

The Requires

 

by Nazmul Alam