stil / gd-text

PHP class making it easy to type text on pictures. Supports multi-lined text, horizontal and vertical alignment.
400 stars 131 forks source link

How to install gd-text ? #27

Closed kikiminou closed 7 years ago

kikiminou commented 7 years ago

I can't find help on how to install gd-text? it looks it's depending on something else.

stil commented 7 years ago

It requires installed php-gd extension, other than that it's free of external dependencies. Show your installation log

kikiminou commented 7 years ago

I have php-gd.

For example the code (taken from the example on homepage):

<?php
require __DIR__.'/../vendor/autoload.php';

use GDText\Box;
use GDText\Color;

$im = imagecreatetruecolor(500, 500);
$backgroundColor = imagecolorallocate($im, 0, 18, 64);
imagefill($im, 0, 0, $backgroundColor);

$box = new Box($im);

produces the logs:

Warning: require(/www/gd-text-test/../vendor/autoload.php): failed to open stream: No such file or directory in /www/gd-text-test/test.php on line 2
Fatal error: require(): Failed opening required '/www/gd-text-test/../vendor/autoload.php' (include_path='.:') in /www/gd-text-test/test.php on line 2
Fatal error: Class 'GDText\Box' not found in /www/gd-text-test/test.php on line 11

What is vendor/autoload.php? Where does it come from? What is in this file?

I noticed you talk about the "installation log". It suggests there is an action to install gd-text. This is what I want to know about.

Thanks for you answer.

stil commented 7 years ago

gd-text is package of Composer. First install Composer, then run following command to install gd-text:

composer require stil/gd-text

It will create vendor/ directory and everything will work fine.