[TYPO3-performance] TS-Rendering - IMG_RESOURCE - 622 ms - Solution

Martin Holtz typo3 at martinholtz.de
Thu Sep 24 21:27:03 CEST 2009


Hi,

> i habe some trouble with an really slow rendered page.
> 
> Admin-Panel shows me rendering times for an IMG_RESOURCE of 622 ms.
> 
> But that happens only to a few images, the most have an rendering time
> of 0 or 1.
I solved my problem. The issue was, that i am using very large images in an 
intranet. So i render thumbnails of images with +50 MB.

Once an image is created, i thought it should not harm anymore.

But it does! On each page creation TYPO3 checks if the original images has 
been modified. So for every used image there is a md5_file() request, which 
takes some times.

I just disabled that function (ok, now there is no check if the image has 
changed, but that does not hurt me in this case).

For those who needs that too:
t3lib/class.t3lib_stdgraphic.php

method getCachedImageDimensions($imageFile)

global $TYPO3_DB;
// Create a md5 hash of the filename
// $md5Hash = md5_file($imageFile);
preg_match('/([^\.]*)$/',$imageFile,$reg);
$res = $TYPO3_DB->exec_SELECTquery ('md5hash, imagewidth, imageheight', 
'cache_imagesizes', 'md5filename='.$TYPO3_DB>fullQuoteStr(md5($imageFile), 
'cache_imagesizes'));
if ($res) {
	if ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
		return (array($row['imagewidth'], $row['imageheight'], 
strtolower($reg[0]), $imageFile));
	}
}
return false;


martin
-- 

http://wiki.typo3.org/Ts45min - TypoScript in "45" Minutes
http://wiki.typo3.org/De:ts45min - (auch in Deutsch)



More information about the TYPO3-performance mailing list