Example #1
0
 /**
  * Resize an GD image
  *
  * @return boolean False if the target image cannot be created, otherwise true
  */
 protected function executeResizeGd()
 {
     $sourceImage = \GdImage::fromFile($this->fileObj);
     $coordinates = $this->computeResize();
     $newImage = \GdImage::fromDimensions($coordinates['width'], $coordinates['height']);
     $sourceImage->copyTo($newImage, $coordinates['target_x'], $coordinates['target_y'], $coordinates['target_width'], $coordinates['target_height']);
     $newImage->saveToFile(TL_ROOT . '/' . $this->getCacheName());
 }