Project

General

Profile

Bug #46020 » imageDimZeroChecker.patch

Markus Klein, 2014-04-01 07:38

View differences:

typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
***************************************************************/
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\SingletonInterface;
/**
......
'cruser_id' => TYPO3_MODE == 'BE' ? $GLOBALS['BE_USER']->user['uid'] : 0
);
$emptyRecord = array_merge($emptyRecord, $additionalFields);
$fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
if (strpos($fileObject->getMimeType(), 'image') === 0) {
throw new \ErrorException('Given metadata did not contain valid width/height data for file: ' . $fileObject->getIdentifier());
}
$this->getDatabaseConnection()->exec_INSERTquery($this->tableName, $emptyRecord);
$record = $emptyRecord;
$record['uid'] = $this->getDatabaseConnection()->sql_insert_id();
......
}
$row = $this->findByFileUid($fileUid);
if (count($updateRow) > 0) {
$fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
if (strpos($fileObject->getMimeType(), 'image') === 0 && (empty($updateRow['width']) || empty($updateRow['height']))) {
throw new \ErrorException('Given metadata did not contain valid width/height data for file: ' . $fileObject->getIdentifier());
}
$updateRow['tstamp'] = time();
$this->getDatabaseConnection()->exec_UPDATEquery($this->tableName, 'uid = ' . (int)$row['uid'], $updateRow);
(8-8/8)