title: Configurable background color when cropping to larger dimensions
body: <p>When I crop the image with one or both dimensions exceeding the source dimensions, the excess area  is rendered in black. </p>
  
  <p>I try to change black in white, but it replace also the black inside the image. </p>
  
  <p>I searched among the various questions and tried many codes but I have not found anything that solves the problem without generate other.</p>
  
  <p><strong>I want white only in the excess area, not inside the image.</strong> </p>
  
  <p>Could you help me? This is my code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function crop($x, $y, $width, $height) 
  {
  if(!$this-&gt;error) 
  {
  $tmpimage = imagecreatetruecolor($width, $height);
        
  imagecopyresampled($tmpimage, $this-&gt;img, 0, 0, $x, $y,
  $width, $height, $width, $height);
           
  $color = imagecolorallocate($tmpimage, 255, 255, 255);
  
  
  imagefill($tmpimage, 0, 0, $color);
  
  
  imagedestroy($this-&gt;img);
  $this-&gt;img = $tmpimage;
  $this-&gt;y = $height;
  $this-&gt;x = $width;
  }
  }</code></pre>
  </div>
  </div>
  </p>