Bug #59215

t3lib_BEfunc::getThumbnail doesn't work anymore

Added by Jens no-lastname-given about 1 year ago. Updated 22 days ago.

Status:Needs Feedback Start date:2014-05-29
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:Backend API Spent time: -
Target version:-
TYPO3 Version:6.2 Is Regression:No
PHP Version:5.4 Sprint Focus:
Complexity:

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

ThumbnailView.php Magnifier (15.3 kB) Jens no-lastname-given, 2014-05-31 00:31


Related issues

related to Core - Bug #50301: Generated thumbnail's URL with BackendUtility::getThumbNa... Accepted 2013-07-22

History

#1 Updated by Jens no-lastname-given about 1 year ago

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.

#2 Updated by Markus Klein about 1 year ago

Maybe you wanna push that to our review system?
Feel free to ask, if you need help.

#4 Updated by Benjamin Mack 22 days ago

  • Status changed from New to Needs Feedback

can you check if the current master / 6.2 works for you?

Also available in: Atom PDF