Weltraumschaf/ebnf — Issue #1: Fatal Error due to missing imageantialias
Author: eviweb
Created: 2012-02-06 21:55:30+00:00
State: open

Hi Sven,

thanks for your great job, It's very useful.

However, I encountered an issue on my first run.

The following error was raised when I was trying to create an image from an EBNF script :
```
PHP Fatal error: Call to undefined function de\weltraumschaf\ebnf\imageantialias() in /usr/share/php/EBNF/Renderer.php on line 208
PHP Stack trace:
PHP 1. {main}() /usr/bin/ebnf:0
PHP 2. de\weltraumschaf\ebnf\Command::main() /usr/bin/ebnf:33
PHP 3. de\weltraumschaf\ebnf\Command->execute() /usr/share/php/EBNF/Command.php:107
PHP 4. de\weltraumschaf\ebnf\Command->generateOutput() /usr/share/php/EBNF/Command.php:231
PHP 5. de\weltraumschaf\ebnf\Renderer->save() /usr/share/php/EBNF/Command.php:257
PHP 6. de\weltraumschaf\ebnf\Renderer->renderNode() /usr/share/php/EBNF/Renderer.php:155
PHP 7. de\weltraumschaf\ebnf\Renderer->renderSyntaxNode() /usr/share/php/EBNF/Renderer.php:271
PHP 8. de\weltraumschaf\ebnf\Renderer->renderNode() /usr/share/php/EBNF/Renderer.php:312
PHP 9. de\weltraumschaf\ebnf\Renderer->renderSequenceNode() /usr/share/php/EBNF/Renderer.php:267
PHP 10. de\weltraumschaf\ebnf\Renderer->renderChilds() /usr/share/php/EBNF/Renderer.php:466
PHP 11. de\weltraumschaf\ebnf\Renderer->renderNode() /usr/share/php/EBNF/Renderer.php:288
PHP 12. de\weltraumschaf\ebnf\Renderer->renderOptionOrLoopNode() /usr/share/php/EBNF/Renderer.php:265
PHP 13. de\weltraumschaf\ebnf\Renderer->renderNode() /usr/share/php/EBNF/Renderer.php:508
PHP 14. de\weltraumschaf\ebnf\Renderer->renderIdentifierOrTerminal() /usr/share/php/EBNF/Renderer.php:263
PHP 15. de\weltraumschaf\ebnf\Renderer->createImage() /usr/share/php/EBNF/Renderer.php:541
```
The problem comes from that my PHP was not compiled with the GD library.
GD was installed and is still used as an external library, and the function ```imageantialias``` is not available, as it is written in the PHP official documentation : http://php.net/manual/en/function.imageantialias.php
```Note: This function is only available if PHP is compiled with the bundled version of the GD library.```

I've just commented the line where this function is called to make the script runnable. Now it works perfectly !
Maybe, it would not be too complicated to allow users to enable/disable this feature, or to do it automatically at runtime by checking the function availability.
What do you thing about this idea ?

Many thanks

Eric