title: php remove pixels border around an image
body: <p>I use the following code to display a remote image and cache a local version of it.</p>
  
  <p>Now i need to find a way to remove 10 pixels all around the image because there's a border that needs to be removed before the image is displayed/cached.</p>
  
  <p>How can i use php to remove 10 pixels on top, bottom, right and left of the image ?</p>
  
  <pre><code>header('Content-type: image/png');
  
  $path = ".......";
  $CACHE_FILE_PATH = "images_tshirts/mini_t/".$a.".png";
  
  if(file_exists($CACHE_FILE_PATH)) {
      echo @file_get_contents($CACHE_FILE_PATH);
  } 
  else {
      $image = imagecreatefromstring(file_get_contents($path));
      // Send the image
      imagepng($image, $CACHE_FILE_PATH);
      echo @file_get_contents($CACHE_FILE_PATH);
      exit();
  }
  ?&gt;
  </code></pre>