public function resize( $width, $height, $maintainAspect = false, $scaleUp = true )
	{
		$oldFrameWidth = $this->frameWidth;
		$aspectRatio = $this->frameWidth / $this->frameHeight;

		if ( $maintainAspect )
		{
			// Try width first
			$newHeight = round( $width / $aspectRatio );

			if ( $newHeight > $height )
			{
				$newWidth = round( $height * $aspectRatio );
				$newHeight = $height;
			}
			else
			{
				$newWidth = $width;
			}

			if ( !$scaleUp && ( ( $newWidth > $this->frameWidth ) || ( $newHeight > $this->frameHeight ) ) )
			{
				// Make no changes as we don't want to scale up.
				return;
			}

			// This is effectively changing the width of our frame.
			$this->frameWidth = $newWidth;
			$this->frameHeight = $newHeight;

			// Use the change in width as a ratio to scale the offsets etc.
			$scale = $oldFrameWidth / $this->frameWidth;

			$this->scaleWidth = ceil( $this->scaleWidth / $scale );
			$this->scaleHeight = ceil( $this->scaleHeight / $scale );

			$this->offsetX = ceil( $this->offsetX / $scale );
			$this->offsetY = ceil( $this->offsetY / $scale );
		}
		else
		{
			if ( !$scaleUp && ( ( $width > $this->scaleWidth ) || ( $height > $this->scaleHeight ) ) )
			{
				// Make no changes as we don't want to scale up
				return;
			}

			$this->scaleWidth = $width;
			$this->scaleHeight = $height;
			$this->frameWidth = $width;
			$this->frameHeight = $height;
		}

		$this->aspectRatio = $this->scaleWidth / $this->scaleHeight;
	}
public function resize( $width, $height, $maintainAspect = false, $scaleUp = true )
	{
		$oldFrameWidth = $this->frameWidth;
		$aspectRatio = $this->frameWidth / $this->frameHeight;

		if ( $maintainAspect )
		{
			// Try width first
			$newHeight = round( $width / $aspectRatio );

			if ( $newHeight > $height )
			{
				$newWidth = round( $height * $aspectRatio );
				$newHeight = $height;
			}
			else
			{
				$newWidth = $width;
			}

			if ( !$scaleUp && ( ( $newWidth > $this->frameWidth ) || ( $newHeight > $this->frameHeight ) ) )
			{
				// Make no changes as we don't want to scale up.
				return;
			}

			// This is effectively changing the width of our frame.
			$this->frameWidth = $newWidth;
			$this->frameHeight = $newHeight;

			// Use the change in width as a ratio to scale the offsets etc.
			$scale = $oldFrameWidth / $this->frameWidth;

			$this->scaleWidth = ceil( $this->scaleWidth / $scale );
			$this->scaleHeight = ceil( $this->scaleHeight / $scale );

			$this->offsetX = ceil( $this->offsetX / $scale );
			$this->offsetY = ceil( $this->offsetY / $scale );
		}
		else
		{
			if ( !$scaleUp && ( ( $width > $this->scaleWidth ) || ( $height > $this->scaleHeight ) ) )
			{
				// Make no changes as we don't want to scale up
				return;
			}

			$this->scaleWidth = $width;
			$this->scaleHeight = $height;
			$this->frameWidth = $width;
			$this->frameHeight = $height;
		}

		$this->aspectRatio = $this->scaleWidth / $this->scaleHeight;
	}
public function resize ( $ width , $ height , $ maintainAspect = false , $ scaleUp = true ) { $ oldFrameWidth = $ this -> frameWidth ; $ aspectRatio = $ this -> frameWidth / $ this -> frameHeight ; if ( $ maintainAspect ) { // Try width first $ newHeight = round ( $ width / $ aspectRatio ) ; if ( $ newHeight > $ height ) { $ newWidth = round ( $ height * $ aspectRatio ) ; $ newHeight = $ height ; } else { $ newWidth = $ width ; } if ( ! $ scaleUp && ( ( $ newWidth > $ this -> frameWidth ) || ( $ newHeight > $ this -> frameHeight ) ) ) { // Make no changes as we don't want to scale up. return ; } // This is effectively changing the width of our frame. $ this -> frameWidth = $ newWidth ; $ this -> frameHeight = $ newHeight ; // Use the change in width as a ratio to scale the offsets etc. $ scale = $ oldFrameWidth / $ this -> frameWidth ; $ this -> scaleWidth = ceil ( $ this -> scaleWidth / $ scale ) ; $ this -> scaleHeight = ceil ( $ this -> scaleHeight / $ scale ) ; $ this -> offsetX = ceil ( $ this -> offsetX / $ scale ) ; $ this -> offsetY = ceil ( $ this -> offsetY / $ scale ) ; } else { if ( ! $ scaleUp && ( ( $ width > $ this -> scaleWidth ) || ( $ height > $ this -> scaleHeight ) ) ) { // Make no changes as we don't want to scale up return ; } $ this -> scaleWidth = $ width ; $ this -> scaleHeight = $ height ; $ this -> frameWidth = $ width ; $ this -> frameHeight = $ height ; } $ this -> aspectRatio = $ this -> scaleWidth / $ this -> scaleHeight ; }
Resizes the image with the given bounds.

@param mixed $width
@param mixed $height
@param mixed $maintainAspect
@param bool $scaleUp
Resizes the image with the given bounds .