lib/ImageResize.php
public function freecrop($width, $height, $x = false, $y = false)
    {
        if ($x === false || $y === false) {
            return $this->crop($width, $height);
        }
        $this->source_x = $x;
        $this->source_y = $y;
        if ($width > $this->getSourceWidth() - $x) {
            $this->source_w = $this->getSourceWidth() - $x;
        } else {
            $this->source_w = $width;
        }

        if ($height > $this->getSourceHeight() - $y) {
            $this->source_h = $this->getSourceHeight() - $y;
        } else {
            $this->source_h = $height;
        }

        $this->dest_w = $width;
        $this->dest_h = $height;

        return $this;
    }
public function freecrop($width, $height, $x = false, $y = false)
    {
        if ($x === false || $y === false) {
            return $this->crop($width, $height);
        }
        $this->source_x = $x;
        $this->source_y = $y;
        if ($width > $this->getSourceWidth() - $x) {
            $this->source_w = $this->getSourceWidth() - $x;
        } else {
            $this->source_w = $width;
        }

        if ($height > $this->getSourceHeight() - $y) {
            $this->source_h = $this->getSourceHeight() - $y;
        } else {
            $this->source_h = $height;
        }

        $this->dest_w = $width;
        $this->dest_h = $height;

        return $this;
    }
public function freecrop ( $ width , $ height , $ x = false , $ y = false ) { if ( $ x === false || $ y === false ) { return $ this -> crop ( $ width , $ height ) ; } $ this -> source_x = $ x ; $ this -> source_y = $ y ; if ( $ width > $ this -> getSourceWidth ( ) - $ x ) { $ this -> source_w = $ this -> getSourceWidth ( ) - $ x ; } else { $ this -> source_w = $ width ; } if ( $ height > $ this -> getSourceHeight ( ) - $ y ) { $ this -> source_h = $ this -> getSourceHeight ( ) - $ y ; } else { $ this -> source_h = $ height ; } $ this -> dest_w = $ width ; $ this -> dest_h = $ height ; return $ this ; }
Crops image according to the given width, height, x and y

@param integer $width
@param integer $height
@param integer $x
@param integer $y
@return static
Crops image according to the given width height x and y