From 3a34369e7e3c260662fa440f341713b6f5f883d5 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 30 Jul 2014 15:10:46 -0400
Subject: [PATCH] Added grid as default mode to prevent PHP warnings in Cover
 Generator.

---
 module/VuFind/src/VuFind/Cover/Generator.php | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/Cover/Generator.php b/module/VuFind/src/VuFind/Cover/Generator.php
index 395a2a36780..7c38107ac18 100644
--- a/module/VuFind/src/VuFind/Cover/Generator.php
+++ b/module/VuFind/src/VuFind/Cover/Generator.php
@@ -64,6 +64,7 @@ class Generator
     {
         $this->themeTools = $themeTools;
         $default = array(
+            'mode'         => 'grid',
             'authorFont'   => 'DroidSerif-Bold.ttf',
             'fontSize'     => 7,
             'lightness'    => 220,
@@ -434,7 +435,7 @@ class Generator
      * @return void
      */
     protected function drawText($im, $text, $x, $y,
-        $font, $fontSize, $mcolor, $scolor, $align = null
+        $font, $fontSize, $mcolor, $scolor=false, $align=null
     ) {
         $txtWidth = $this->textWidth(
             $text,
@@ -460,10 +461,12 @@ class Generator
         }
 
         // Generate 5 lines of text, 4 offset in a border color
-        imagettftext($im, $fontSize, 0, $x,   $y+1, $scolor, $font, $text);
-        imagettftext($im, $fontSize, 0, $x,   $y-1, $scolor, $font, $text);
-        imagettftext($im, $fontSize, 0, $x+1, $y,   $scolor, $font, $text);
-        imagettftext($im, $fontSize, 0, $x-1, $y,   $scolor, $font, $text);
+        if ($scolor) {
+            imagettftext($im, $fontSize, 0, $x,   $y+1, $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x,   $y-1, $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x+1, $y,   $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x-1, $y,   $scolor, $font, $text);
+        }
         // 1 centered in main color
         imagettftext($im, $fontSize, 0, $x,   $y,   $mcolor, $font, $text);
     }
-- 
GitLab