Skip to content

Instantly share code, notes, and snippets.

@kathangeorg
Last active December 20, 2015 23:08
Show Gist options
  • Save kathangeorg/6209813 to your computer and use it in GitHub Desktop.
Save kathangeorg/6209813 to your computer and use it in GitHub Desktop.
TYPO3 FED thumbs.php Bug: Images are not shown in backend if there is an ' ' on the beginning of thumbs.php at rendering an image -> in my case warnings from FED made ' ' at the beginning
It's not only RealURL's problem - although it's most common while users are manipulating this file manually to add custom rules. Anyway this problem also ocures with typo3conf/localconf.php.
How to confirm:
Right click on the broken image and choose Open image in new window it will open a file with address like: http://somedomain.tld/typo3/thumbs.php?&file=..%2Fuploads%2...etc use some browser to preview the source code ie. in Chrome prepend the address with view-source: like: view-source:http://somedomain.tld/typo3/thumbs.php?&file=...etc. There should not be any whitespaces before the code of image...
How to prevent?
As you wrote. Check your config files like realurl_conf.php or localconf.php and make sure that there are no spaces before <?php. In case of script ending.... just remove the ?> tag, so script will end automatically without white spaces (even if you'll add 100 empty lines after last line of code), unfortunately sometimes finding this one annoying space in configs takes hours, so....
How to fix permanently?
I'm surprised, that isn't fixed after all these years still, while it's quite easy with ob_end_clean(), edit file: t3lib/thumbs.php, at the beginning (ie. right after php tag) add line:
<?php
ob_start();
Next find main() method, add at its begining line for cleaning output buffer, which will remove all garbage included from other files:
function main() {
ob_end_clean(); //here
...
Voila!
-> SOLUTION for FED -> ext/fed/ext_localconf.php
if ($loadBackendConfiguration) {
// init array() or error will occure!!
$fedWizardElements = array(); //gk 1308
if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fed']['setup']['enableSolrFeatures']
|| $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fed']['setup']['enableFrontendPlugins']
) {
array_push($fedWizardElements, 'template');
array_push($fedWizardElements, 'datasource');
array_push($fedWizardElements, 'solr');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment