Skip to content

Conversation

@chrisi51
Copy link

This pull request addresses #83 . In Composer-based installations, the var directory is located one level above the public folder, whereas in classic installations it resides within public. Currently, the extension uses Environment::getVarPath() to get an absolute path, which causes TYPO3’s core to prepend the public path. This results in an incorrect file path like:

/var/www/html/public//var/...

To resolve this, I modified the fileName() method in Imaging/GifBuilder.php to dynamically calculate the relative path from the public directory to the var directory. The approach works as follows:

  • Case 1: If the var directory is inside public, the code simply strips the public part from the absolute var path.
  • Case 2: If the var directory is outside public (typical for Composer installations), it calculates the number of directory levels to go up (../) and appends the remaining var path.
  • Finally, the method returns the relative path (from the public directory) to the temporary folder where the GIF is stored. This allows TYPO3 to correctly prepend the public path without duplicating it.

This change ensures that Filefill works correctly across all TYPO3 installations and versions by providing a correct relative path for the GIF builder output. Please review the changes and let me know if further adjustments are needed.

@IchHabRecht
Copy link
Owner

Hi @chrisi51,

Thank you for your pull request. I think I would prefer to either have a switch depending on the TYPO3 version in use or at least use \TYPO3\CMS\Core\Utility\PathUtility::getRelativePath and not try to calculate any relative path on my own. I try to have a look at the issue on the upcoming weekend. I think I need to understand why the core changed its api to decide which option would be the best.

@chrisi51
Copy link
Author

didn't knew of \TYPO3\CMS\Core\Utility\PathUtility::getRelativePath ... that makes it a little more easier =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants