[TYPO3-german] Re: FAL in css_styled_content
Thomas Skierlo
tsk at pix-pro.eu
Fri Oct 4 14:44:30 CEST 2013
so scheint's zu gehen. Keine Ahnung, ob das "richtiger" ist. Wirkt irgendwie sehr "teuer":
if ($equalHeight) {
// Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
$gifCreator = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
$gifCreator->init();
$relations_cols = array();
// contains the individual width of all images after scaling to $equalHeight
$imgWidths = array();
$resFactory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Resource\ResourceFactory'); // create instance to storage repository
for ($a = 0; $a < $imgCount; $a++) {
$imgKey = $a + $imgStart;
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($imgs[$imgKey])) {
$file = $resFactory->getFileObject($imgs[$imgKey]);
$fileProps = $file->getProperties();
$origWidth = $fileProps['width'];
$origHeight = $fileProps['height'];
} else {
$totalImagePath = $imgPath . $imgs[$imgKey];
$imgInfo = $gifCreator->getImageDimensions($totalImagePath);
$origWidth = $imgInfo[0];
$origHeight = $imgInfo[1];
}
$rel = $origHeight / $equalHeight;
// if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error.
if ($rel) {
$imgWidths[$a] = $origWidth / $rel;
// counts the total width of the row with the new height taken into consideration.
$relations_cols[(int) floor($a / $colCount)] += $imgWidths[$a];
}
}
}
Die Frage bleibt offen. Geht das so?
More information about the TYPO3-german
mailing list