Eugenio Goryaev
Desarrollo, soporte y optimización

floor12/imagenator Generation of an image for OpenGraph with a logo and title of a page or article.

Build Status Scrutinizer Code Quality

Этот файл доступен на русском языке.


PHP library for generate image with a article title to use it in OpenGraph. It takes PNG image is a background and put text on it. The text position, size, font, color and other parameters. In addition, the library correctly processes "hanging prepositions": it wrap words shorter than 3 letters to the next line, if it exists.

For example:




Add this library to your project

 $ composer require floor12/imagenator

or add this to the require section of your composer.json.

 "floor12/imagenator": "dev-master"


Pass background PNG file path to the class constructor:

use floor12\imagenator\Imagenator;

$imagenator = new Imagenator('/project/images/image.png');

Then, you can setup any of additional parameters using some setters:

    ->setColor('FF04AB')                    // Font color in HEX format;
    ->setFont('/fonts/SomeFont.ttf')        // Path to custom font;
    ->setFontSize(3)                        // Font size in percent of image height;
    ->setPadding(5)                         // Horizontal padding in percent of image width;
    ->setMarginTopInPercents(50)            // Margin from top image edge in percent of image height;
    ->setRowHeight(7)                       // Row height in percent of image height;
    ->setText('This is an article title.'); // Text to put over the image;

After that, you can generate result PNG image: