[TYPO3-english] GifBuilder call w. FAL Assets
Thomas Skierlo
tsk at pix-pro.eu
Thu Oct 3 09:38:15 CEST 2013
I'm currently writing a hook for css_styled_content image rendering. The hook renders everything in Twitter Bootstrap 3 styles, and it is working as expected for the standard case, images with or without a width specified. To get it working for images with equalHeight setting too, I need to read width and height settings from the original images.
The original part from CssStyledContent\Controller looks like:
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();
for ($a = 0; $a < $imgCount; $a++) {
$imgKey = $a + $imgStart;
$imgInfo = $gifCreator->getImageDimensions($imgPath . $imgs[$imgKey]);
// relationship between the original height and the wished height
$rel = $imgInfo[1] / $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] = $imgInfo[0] / $rel;
// counts the total width of the row with the new height taken into consideration.
$relations_cols[(int)floor($a / $colCount)] += $imgWidths[$a];
}
}
}
AND - this part is NOT working. Try to debug $rel or $imgInfo. It's always empty. The reason seams obvious. For a FAL image the $imgInfo call translates to something like "uploads/pics/915".
The propper way to check the pass seems to be:
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($imgs[$imgKey])) {
$totalImagePath = intval($imgs[$imgKey]);
} else {
$totalImagePath = $imgPath . $imgs[$imgKey];
}
But this is not working for the gifBuilder part.
What is the current propper way to read image dimensions from a given FAL image?
Thanks for any help,
Thomas
More information about the TYPO3-english
mailing list