Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Classes/Imaging/GifBuilder.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<?php

namespace IchHabRecht\Filefill\Imaging;

use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;

class GifBuilder extends \TYPO3\CMS\Frontend\Imaging\GifBuilder
{
public function fileName($pre)
{
$fileName = parent::fileName($pre);
$temporaryPath = Environment::getVarPath() . '/transient/';
if (!is_dir($temporaryPath)) {
GeneralUtility::mkdir_deep($temporaryPath);
$absoluteVarPath = Environment::getVarPath();
$publicPath = Environment::getPublicPath();

// Calculate the relative path from the public directory to the var directory:
$relativeVarPath = PathUtility::getRelativePath($publicPath, $absoluteVarPath);

// Ensure that the temporary folder exists (relative to public)
$absoluteTemporaryPath = $publicPath . '/' . $relativeVarPath . '/transient/';
if (!is_dir($absoluteTemporaryPath)) {
GeneralUtility::mkdir_deep($absoluteTemporaryPath);
}

return $temporaryPath . basename($fileName);
// Return: the relative path (from the public directory) to the temporary image
return $relativeVarPath . '/transient/' . basename($fileName);
}
}
Loading