Craft\ImageResizerTask::runStep PHP Method

runStep() public method

public runStep ( $step )
    public function runStep($step)
    {
        $asset = craft()->assets->getFileById($this->_assets[$step]);
        $sourceType = craft()->assetSources->getSourceTypeById($asset->sourceId);
        $path = $sourceType->getImageSourcePath($asset);
        $folder = $asset->folder;
        $fileName = $asset->filename;
        // Gives us a way to determine that this is different from an on-upload function
        craft()->httpSession->add('ImageResizer_ResizeElementAction', true);
        // Store width/height overrides
        craft()->httpSession->add('ImageResizer_ResizeElementActionWidth', $this->_imageWidth);
        craft()->httpSession->add('ImageResizer_ResizeElementActionHeight', $this->_imageHeight);
        // This will trigger our `assets.onBeforeUploadAsset` hook
        craft()->assets->insertFileByLocalPath($path, $fileName, $folder->id, AssetConflictResolution::Replace);
        return true;
    }