Command Line

Locally Installed DrawShield

It is possible to run DrawShield by installing it on your system and invoking it from the command line.

Requirements

You will need PHP8.1 or above (8.2 may generate deprecation warnings). You will need PHP extensions for libxml, iconv, mbstring and possibly some others, you should get warning messages about what is needed.

The program may sometimes get into a loop so I would suggest setting limits for maximum memory usage and execution time in your php.ini file. Some large blazons can take a long time to process and may use a lot of memory so set these limits quite generously.

The basic program will produce SVG files. For conversion to other formats I suggest installing ImageMagick and using its 'convert' program.

Installation

Download the code from the DrawShield repository on Github. You can either clone the repository or download the code as a zip file. Unzip the code into a folder on your system, you will require up to 150MB of disk.

Simple Command Line

At it simplest, running DrawShield from the command line will just concatenate all of the arguments into a single string, separated by spaces and this will be treated as the blazon. An SVG image will be created which will be 500 units wide and 600 units high, using the DrawShield colour scheme, the heater shield shape and no drawing effects. The SVG data will be written to the standard output.

The program should be run from the top level directory containing the drawshield code. An example command line would be:

php drawshield.php azure a bend or

Command Line Arguments

You can also set the same options as the API by using command line arguments of the form:

argument=“value”

Where ‘argument’ is the same as shown on the API page and value is the chosen value. If you use an argument to set the blazon then it should be a single, URL encoded value.

Any remaining arguments (i.e. not starting with ‘-‘) will be concatenated with spaces and used as the blazon, for example:

php drawshield.php —-effect=stonework —-shape=french argent a cross wavy gules

Debugging From the Command Line

If there are no arguments at all the program will instead look for a file in the same folder named ‘debug.inc’. If this exists it will be “included” and hence should consist of PHP code. Most usefully this code should set the various values of the $options array, for example:

$options[“blazon”] = ”azure a bend or“;

You can also set other options as required. This is the suggested method for using a PHP debugger.


Please Help!

Gallery

Test Me

flashcard image