Add error in case no GD is present.

This commit is contained in:
Michiel Sikma
2015-07-20 11:56:02 +09:00
parent ef6c22e079
commit abda706e0d
2 changed files with 7 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ class I18n
'icon_dir_failure' => "<frm=red>Couldn't open icon directory (%s). Skipping.</frm>\n",
'dir_create' => "Creating output directory.\n",
'dir_error' => "<frm=red>Couldn't create directories.</frm>\n",
'gd_error' => "<frm=red>Error: GD functions seem to be missing, e.g. imagecreatefrompng(). Install them or recompile PHP with GD support, then try again.</frm>\n",
'dir_success' => "<frm=green>Dirs successfully created.</frm>\n",
'no_cli' => "<frm=red>We don't seem to be running via the command line. Keep in mind this tool was designed for command line usage, and hasn't been tested in other situations.</frm>\n",
'pngcrush_missing' => "<frm=red>pngcrush seems to be missing (path: %s). By default, it needs to be in the tools directory, chmodded to be executable, and at least version 1.7.60.\nImage will not be optimized by pngcrush.</frm>\n",

View File

@@ -105,6 +105,12 @@ I18n::set_default_lines();
$termfrm = new TerminalFormatter();
I18n::add_output_filter(array('PkSpr\TerminalFormatter', 'format'));
// Check if we have GD.
if (!function_exists('imagecreatefrompng')) {
print(I18n::l('gd_error'));
die();
}
// Print basic program info.
print(I18n::lf('info', array(
$title_str,