public function cropImage($x, $y, $width, $height, $rotate)
    {
        $DS = DIRECTORY_SEPARATOR;
        $savePath = Yii::getAlias($this->_savePathAlias);
        $imageSrc = $this->owner->{$this->_imageAttribute};
        $fullImagePath = $savePath . $DS . $imageSrc;

        $imageComponent = static::getImageComponent();
        /* @var $image Image_GD|Image_Imagick */
        $image = $imageComponent->load($this->getOriginalImagePath());

        $image->crop($width, $height, $x, $y);
        $image->rotate($rotate);

        $image->save($fullImagePath);

        $sizes = $this->getImageSizes();
        unset($sizes['']);

        $pathParts = explode('/', str_replace('\\', '/', $imageSrc));
        $filename = array_pop($pathParts);

        // Make resize
        return static::resizeAndSave($savePath . $DS . implode($DS, $pathParts), $filename, $sizes);
    }
public function cropImage($x, $y, $width, $height, $rotate)
    {
        $DS = DIRECTORY_SEPARATOR;
        $savePath = Yii::getAlias($this->_savePathAlias);
        $imageSrc = $this->owner->{$this->_imageAttribute};
        $fullImagePath = $savePath . $DS . $imageSrc;

        $imageComponent = static::getImageComponent();
        /* @var $image Image_GD|Image_Imagick */
        $image = $imageComponent->load($this->getOriginalImagePath());

        $image->crop($width, $height, $x, $y);
        $image->rotate($rotate);

        $image->save($fullImagePath);

        $sizes = $this->getImageSizes();
        unset($sizes['']);

        $pathParts = explode('/', str_replace('\\', '/', $imageSrc));
        $filename = array_pop($pathParts);

        // Make resize
        return static::resizeAndSave($savePath . $DS . implode($DS, $pathParts), $filename, $sizes);
    }
public function cropImage ( $ x , $ y , $ width , $ height , $ rotate ) { $ DS = DIRECTORY_SEPARATOR ; $ savePath = Yii :: getAlias ( $ this -> _savePathAlias ) ; $ imageSrc = $ this -> owner -> { $ this -> _imageAttribute } ; $ fullImagePath = $ savePath . $ DS . $ imageSrc ; $ imageComponent = static :: getImageComponent ( ) ; /* @var $image Image_GD|Image_Imagick */ $ image = $ imageComponent -> load ( $ this -> getOriginalImagePath ( ) ) ; $ image -> crop ( $ width , $ height , $ x , $ y ) ; $ image -> rotate ( $ rotate ) ; $ image -> save ( $ fullImagePath ) ; $ sizes = $ this -> getImageSizes ( ) ; unset ( $ sizes [ '' ] ) ; $ pathParts = explode ( '/' , str_replace ( '\\' , '/' , $ imageSrc ) ) ; $ filename = array_pop ( $ pathParts ) ; // Make resize return static :: resizeAndSave ( $ savePath . $ DS . implode ( $ DS , $ pathParts ) , $ filename , $ sizes ) ; }
Crop original image and resave resized images

@param int $x
@param int $y
@param int $width
@param int $height
@param int $rotate

@return bool
Crop original image and resave resized images