Project

General

Profile

Bug #21269 » 12232_06.diff

Administrator Admin, 2011-01-18 22:37

View differences:

t3lib/class.t3lib_stdgraphic.php (working copy)
* @author Michael Stucki <michael@typo3.org> / Robert Lemke <rl@robertlemke.de>
*/
function cacheImageDimensions($identifyResult) {
global $TYPO3_DB;
// Create a md5 hash of the filename
$md5Hash = md5_file($identifyResult[3]);
// Create md5 hash of filemtime and filesize
$md5Hash = md5(filemtime($identifyResult[3]) . filesize($identifyResult[3]));
$result = FALSE;
if ($md5Hash) {
$fieldArr = array(
$fieldArray = array(
'md5hash' => $md5Hash,
'md5filename' => md5($identifyResult[3]),
'tstamp' => $GLOBALS['EXEC_TIME'],
......
'imagewidth' => $identifyResult[0],
'imageheight' => $identifyResult[1],
);
$TYPO3_DB->exec_INSERTquery('cache_imagesizes', $fieldArr);
if (!$err = $TYPO3_DB->sql_error()) {
return TRUE;
$GLOBALS['TYPO3_DB']->exec_INSERTquery(
'cache_imagesizes',
$fieldArray
);
if (!$err = $GLOBALS['TYPO3_DB']->sql_error()) {
$result = TRUE;
}
}
return FALSE;
return $result;
}
/**
......
* @author Robert Lemke <rl@robertlemke.de>
*/
function getCachedImageDimensions($imageFile) {
// Create a md5 hash of the filename
$md5Hash = md5_file($imageFile);
// Create md5 hash of filemtime and filesize
$md5Hash = md5(filemtime($imageFile) . filesize($imageFile));
preg_match('/([^\.]*)$/', $imageFile, $imageExtension);
$cachedImageDimensions = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
'md5hash, md5filename, imagewidth, imageheight',
'cache_imagesizes',
......
'md5filename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($cachedImageDimensions['md5filename'], 'cache_imagesizes')
);
} else {
preg_match('/([^\.]*)$/', $imageFile, $imageExtension);
$result = array(
(int)$cachedImageDimensions['imagewidth'],
(int)$cachedImageDimensions['imageheight'],
(3-3/3)