| // +---------------------------------------------------------------------------+ /** * Strategy for resizing images. * * @package SGL * @author Dmitri Lakachauskis */ class SGL_ImageTransform_ResizeStrategy extends SGL_ImageTransformStrategy { function transform() { $width = isset($this->aParams['width']) ? $this->aParams['width'] : null; $height = isset($this->aParams['height']) ? $this->aParams['height'] : null; $aSize = $this->driver->getImageSize(); $ret = true; if (isset($width) && isset($height)) { if ($aSize[0] > $width || $aSize[1] > $height) { $ret = $this->driver->fit($width, $height); } } elseif (isset($width) && $aSize[0] > $width) { $ret = $this->driver->scaleByX($width); } elseif (isset($height) && $aSize[1] > $height) { $ret = $this->driver->scaleByY($height); } return $ret; } } ?>