protected function resize($args)
{
$target = $args['target'];
$width = (int) $args['width'];
$height = (int) $args['height'];
$x = (int) $args['x'];
$y = (int) $args['y'];
$mode = $args['mode'];
$bg = $args['bg'];
$degree = (int) $args['degree'];
$quality = (int) $args['quality'];
if (($volume = $this->volume($target)) == false || ($file = $volume->file($target)) == false) {
return array('error' => $this->error(self::ERROR_RESIZE, '#' . $target, self::ERROR_FILE_NOT_FOUND));
}
if ($mode !== 'rotate' && ($width < 1 || $height < 1)) {
return array('error' => $this->error(self::ERROR_RESIZESIZE));
}
return ($file = $volume->resize($target, $width, $height, $x, $y, $mode, $bg, $degree, $quality)) ? array('changed' => array($file)) : array('error' => $this->error(self::ERROR_RESIZE, $volume->path($target), $volume->error()));
}