Bug #59215
closed
t3lib_BEfunc::getThumbnail doesn't work anymore
Added by Jens no-lastname-given over 10 years ago.
Updated about 9 years ago.
Description
I migrated from 4.5 to 6.2.3. In 4.5 t3lib_BEfunc::getThumbnail($this->doc->backPath.'thumbs.php',PATH_site.$path.$file,'null',$imgsize) worked perfect.
In 6.2 an absolute path like PATH_site.$path.$file does not work in \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\ThumbnailView') in init(). It is changed to PATH_site.PATH_site.$path.$file
A relative path like ../fileadmin/picture/test.jpg is accepted but the md5 check fails ($fileObject->calculateChecksum() == $md5sum). May be t3lib_BEfunc::getThumbnail is generating a wrong md5 checksum.
A relative path like fileadmin/picture/test.jpg is changed to /typo3/fileadmin/picture/test.jpg what is completly wrong
Files
We have 2 Problems:
t3lib_BEfunc::getThumbnail needs an absolute path and it uses function md5
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\ThumbnailView')->init() in thumbs.php needs a relative path and uses function GeneralUtility::shortMD5
In the past t3lib_BEfunc::getThumbnail uses an absolute path. So for backwards compatibility I have changed only ThumbnailView.php
I have made a relative path from an absolute path in line 135
$relativeFilePath = substr($relativeFilePath,strlen(PATH_site));
I added PATH_site in line 169
$check = basename(PATH_site . $relativeFilePath) . ':' . $mTime . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
I use md5 instead of GeneralUtility::shortMD5 in line 171
if (md5($check) === (string)$md5sum)
In the attachment you find my ThumbnailView.php which works as described.
Maybe you wanna push that to our review system?
Feel free to ask, if you need help.
- Status changed from New to Needs Feedback
can you check if the current master / 6.2 works for you?
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.
Also available in: Atom
PDF