[TYPO3-core] RFC: fix bug: 6561 imgMax and imgStart (IMGTEXT) not working properly

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Oct 31 10:13:26 CET 2007


Ingmar Schlecht wrote: on 29.10.2007 22:44:

> Helmut Hummel wrote:
>> Thank you, but I'm very sorry, that I have to admit, that I' ve overseen
>> something important. 
> 
> Well, those things happen, no problem.
> 
>> The images are now shown correctly, but the title,
>> captions, links, etc. are wrongly calculated.
>>
>> Solution: fill the IMAGE_NUM_CURRENT register with the right index
>> number (see attached patch).
> 
> IMAGE_NUM and IMAGE_NUM_CURRENT used to be the same. Do you (or Ernesto,
> maybe) know what the difference between them is and whether or not
> IMAGE_NUM should also be set to the new value? I was just wondering
> about that when I was checking the code. I couldn't find any other
> occurence of IMAGE_NUM in the code but only some documentation at [1].
> 
> Relevant lines:
>>  			$GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
>> -			$GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
>> +			$GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a+$imgStart;
>>  			$GLOBALS['TSFE']->register['ORIG_FILENAME'] = $totalImagePath;

Well, to be honest I remember there "was something" that was fixed
involving these registers and one of them is still there for backwards
compatibility reasons. I don't recall exactly, but here is my view:

IMAGE_NUM was the register provided by original IMGTEXT and still used
in content(default). This was kept to provide backwards compatible
TypoScript.

IMAGE_NUM_CURRENT was added in css_styled_content because IMAGE_NUM was
kind of buggy. With http://bugs.typo3.org/view.php?id=3416 and v4.0.1
the original IMAGE_NUM in IMGTEXT was "fixed", and after that both
registers seems to have the same behaviour.

To be consistent both registers should do the same, which also means set
the correct index in the image list we are running through. This is used
in TypoScript to get the matching caption, alt-text, links, etc, which
need to know which image we are currently handling.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list