Contao\CoreBundle\Test\Image\ImageFactoryTest::getImageHookCallback PHP Method

getImageHookCallback() public static method

Returns a custom image path.
public static getImageHookCallback ( string $originalPath, integer $targetWidth, integer $targetHeight, string $resizeMode, string $cacheName, object $fileObj, string $targetPath, object $imageObj ) : string
$originalPath string The original path
$targetWidth integer The target width
$targetHeight integer The target height
$resizeMode string The resize mode
$cacheName string The cache name
$fileObj object The file object
$targetPath string The target path
$imageObj object The image object
return string The image path
    public static function getImageHookCallback($originalPath, $targetWidth, $targetHeight, $resizeMode, $cacheName, $fileObj, $targetPath, $imageObj)
    {
        // Do not include $cacheName as it is dynamic (mtime)
        $path = 'assets/' . $originalPath . '&getImage' . '_' . $targetWidth . '_' . $targetHeight . '_' . $resizeMode . '_' . str_replace('\\', '-', get_class($fileObj)) . '_' . $targetPath . '_' . str_replace('\\', '-', get_class($imageObj)) . '.jpg';
        if (!file_exists(dirname(TL_ROOT . '/' . $path))) {
            mkdir(dirname(TL_ROOT . '/' . $path), 0777, true);
        }
        file_put_contents(TL_ROOT . '/' . $path, '');
        return $path;
    }