$args) { if ( ! $this->$func($args)) return FALSE; } return TRUE; } protected function sanitize_geometry( & $geometry) { list($width, $height) = $this->properties(); $reporting = error_reporting(0); $geometry['width'] = min($geometry['width'], $width); $geometry['height'] = min($geometry['height'], $height); if ($geometry['top'] === 'center') { $geometry['top'] = floor(($height / 2) - ($geometry['height'] / 2)); } elseif ($geometry['top'] === 'top') { $geometry['top'] = 0; } elseif ($geometry['top'] === 'bottom') { $geometry['top'] = $height - $geometry['height']; } if ($geometry['left'] === 'center') { $geometry['left'] = floor(($width / 2) - ($geometry['width'] / 2)); } elseif ($geometry['left'] === 'left') { $geometry['left'] = 0; } elseif ($geometry['left'] === 'right') { $geometry['left'] = $width - $geometry['height']; } error_reporting($reporting); } abstract protected function properties(); abstract public function process($image, $actions, $dir, $file); abstract function flip($direction); abstract function crop($properties); abstract public function resize($properties); abstract public function rotate($amount); abstract public function sharpen($amount); }