Bug #93860
closedOnline media helpers (YouTubeHelper, VimeoHelper) preview images unusable in composer mode
100%
Description
When in composer mode, the online media helpers create preview images in locations like "./var/transient/youtube_1e65d7002154f3586b97bd19d2787829.jpg". But this files can't be accessed from e.g. "<f:image>" any longer, because "ResourceFactory::retrieveFileOrFolderObject()" wrongly returns a (non existing) folder object instead of file object. This is the case because "ResourceFactory::retrieveFileOrFolderObject()" uses "Environment::getPublicPath()" in behind but paths like "/var/transient/" are not public.
Steps to reproduce:
- Upload any youtube or vimeo video from backend
- Assign it to any record or model
- In FLUID, let it be rendered using "<f:image>" (when using "image" instead of "media" viewhelper, this automatically reads or creates the thumbnail)
This crashes the frontend.
Solution: Let the online media helpers create the preview images not inside "/var/transient" but in a real "public" path instead.
Updated by Jan Kornblum over 3 years ago
- Related to Bug #93823: ResourceFactory::retrieveFileOrFolderObject() wrongly returns Folder instead of File object added
Updated by Frans Saris over 3 years ago
- Related to Feature #84545: Use dynamic path for typo3temp/var/ added
Updated by Frans Saris over 3 years ago
- Related to Bug #72822: Move all typo3temp files below typo3temp/var or typo3temp/assets added
Updated by Frans Saris over 3 years ago
- Related to Task #72580: Move publicly accessible files to typo3temp/assets/ added
Updated by Frans Saris over 3 years ago
Jan,
Changing the temp folder to a public one would probably fix this.
Use Environment::getPublicPath()
instead of Environment::getVarPath()
in \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper
Introduced here https://review.typo3.org/c/Packages/TYPO3.CMS/+/56413/9/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/AbstractOnlineMediaHelper.php#122
But think that the transient
folder is also not correct. Should be something like /assets/online-media-preview/
So result:
/** * Get temporary folder path to save preview images * * @return string */ protected function getTempFolderPath() { $path = Environment::getPublicPath() . '/assets/online-media-preview/'; if (!is_dir($path)) { GeneralUtility::mkdir_deep($path); } return $path; }
The folder name was changed here https://review.typo3.org/c/Packages/TYPO3.CMS/+/46096/14/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/AbstractOnlineMediaHelper.php#121 and
But I'm not 100% sure if this would be the correct solution. As this is only a temp file. Maybe the view shouldn't depend on this file, but the <f:image
viewhelper should create a `_processed` file that would be in `typo3temp/assets`.
Start of the folder move was here https://review.typo3.org/c/Packages/TYPO3.CMS/+/45669/ and there is clearly states it should be a public folder.
Updated by Frans Saris over 3 years ago
I think it would be even better to rename the method:
/** * Get publicly accessible temporary folder path to save preview images * * @return string */ protected function getPublicTempFolderPath() { $path = Environment::getPublicPath() . '/assets/online-media-preview/'; if (!is_dir($path)) { GeneralUtility::mkdir_deep($path); } return $path; }
Updated by Benni Mack over 3 years ago
Actually, the preview images should be special FAL images or processed files in the future, as the local setup completely bypasses any useful handling for our File-system abstraction layer.
Updated by Gerrit Code Review over 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472
Updated by Gerrit Code Review over 3 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472
Updated by Gerrit Code Review over 3 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472
Updated by Gerrit Code Review over 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70213
Updated by Benni Mack over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8dc8757c4a059b61ac8210c7f6f105986f71b3d8.
Updated by Gerrit Code Review over 3 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70214
Updated by Benni Mack over 3 years ago
- Status changed from Under Review to Resolved
Applied in changeset 42eda81dfd05d54cf875adeb18c1047ca380eb47.