Craft\ImageResizer_CropService::crop PHP Method

crop() public method

=========================================================================
public crop ( $asset, $x1, $x2, $y1, $y2 )
    public function crop($asset, $x1, $x2, $y1, $y2)
    {
        $sourceType = craft()->assetSources->getSourceTypeById($asset->sourceId);
        $path = $sourceType->getImageSourcePath($asset);
        $folder = $asset->folder;
        $fileName = $asset->filename;
        // Perform the actual cropping
        $this->_cropWithPath($path, $x1, $x2, $y1, $y2);
        // To make sure we don't trigger resizing in the below `assets.onBeforeUploadAsset` hook
        craft()->httpSession->add('ImageResizer_CropElementAction', true);
        // This will trigger our `assets.onBeforeUploadAsset` hook
        craft()->assets->insertFileByLocalPath($path, $fileName, $folder->id, AssetConflictResolution::Replace);
        return true;
    }
ImageResizer_CropService