Bug #48354

wrong placement of image caption in text w/image

Added by Riccardo De Contardi over 6 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2013-05-17
Due date:
% Done:

100%

TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce in TYPO3 6.1.0:

1. create a CE text/w images and add 3 images
2. leave the caption of the 1st and 2nd image empty, add a caption to the 3rd image only
3. arrange them as you like (appereance tab > image alignment); Number of Columns: what you like.
4. the caption is placed after the 1st image

The same thing happens when you leave the 1st image without caption and put a caption on 2nd and 3rd.
Oddly, if you put a caption on 1st and 3rd image, they are placed correctly.

It seems that if you leave the 1st image without caption, all the others shifts (!)


Related issues

Related to TYPO3 Core - Bug #57235: Image caption appears under wrong image Closed 2014-03-24

Associated revisions

Revision 1bfea3b8 (diff)
Added by Philipp Gampe over 6 years ago

[BUGFIX] Wrong placement of image caption in text with image

If you omit the first caption, then the following captions are shifted
into this position, meaning the the captions are off by the number of
empty captions in front.

This happens because the captions are stored with a newline "\n" as
separator which is removed by a trim = 1.

Remove this trim from tt_content.image.20.caption.1.1 as the trimming of
the actual content happens with
tt_content.image.20.caption.1.stdWrap.trim = 1.

The change also has a few cleanups that popped up in PhpStorm while
investigation the issue.

Resolves: #48354
Releases: 6.2, 6.1, 6.0
Change-Id: I4523fa40cbf991b3941d18145a09e72d5e5254d3
Reviewed-on: https://review.typo3.org/20884
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind

Revision af81c6c9 (diff)
Added by Philipp Gampe over 6 years ago

[BUGFIX] Wrong placement of image caption in text with image

If you omit the first caption, then the following captions are shifted
into this position, meaning the the captions are off by the number of
empty captions in front.

This happens because the captions are stored with a newline "\n" as
separator which is removed by a trim = 1.

Remove this trim from tt_content.image.20.caption.1.1 as the trimming of
the actual content happens with
tt_content.image.20.caption.1.stdWrap.trim = 1.

The change also has a few cleanups that popped up in PhpStorm while
investigation the issue.

Resolves: #48354
Releases: 6.2, 6.1, 6.0
Change-Id: I4523fa40cbf991b3941d18145a09e72d5e5254d3
Reviewed-on: https://review.typo3.org/21727
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind

Revision c8f54030 (diff)
Added by Philipp Gampe over 6 years ago

[BUGFIX] Wrong placement of image caption in text with image

If you omit the first caption, then the following captions are shifted
into this position, meaning the the captions are off by the number of
empty captions in front.

This happens because the captions are stored with a newline "\n" as
separator which is removed by a trim = 1.

Remove this trim from tt_content.image.20.caption.1.1 as the trimming of
the actual content happens with
tt_content.image.20.caption.1.stdWrap.trim = 1.

The change also has a few cleanups that popped up in PhpStorm while
investigation the issue.

Resolves: #48354
Releases: 6.2, 6.1, 6.0
Change-Id: I4523fa40cbf991b3941d18145a09e72d5e5254d3
Reviewed-on: https://review.typo3.org/21726
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind

History

#1 Updated by Philipp Gampe over 6 years ago

  • Status changed from New to Accepted
  • Target version deleted (6.1.1)
  • TYPO3 Version changed from 6.1 to 6.0

#2 Updated by Philipp Gampe over 6 years ago

OK, first part of the puzzle: The captions are passed as newline separated value inside the data:imagecaption = \nCaption Image 2\ncaption image 3

Thus the first caption is empty ... I guess later this empty value cause the other to shift ... I will now go in with debugging ;)

#3 Updated by Philipp Gampe over 6 years ago

Ha ... and next comes a trim :D This removes the \n at the beginning ... in PHP trim(content). This leaves us with Caption Image 2\ncaption image 3, which means now caption 2 is shifted to caption 1 ;)

#4 Updated by Philipp Gampe over 6 years ago

You can help yourself by removing the trim = 1 from stdWrap.

tt_content.image.20.caption.1.1.trim >

That means also that you must not have any newlines in your caption.

#5 Updated by Gerrit Code Review over 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20884

#6 Updated by Riccardo De Contardi over 6 years ago

I think this could be an heritage of version 4.7: if I remember, prior to FAL, the caption field was a single field against multiple images, and you had to separate the captions with a new line: a line for each caption ;)

#7 Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20884

#8 Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/21726

#9 Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/21727

#10 Updated by Philipp Gampe over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#11 Updated by Mathias Brodala almost 6 years ago

Just for the record: this also affects TYPO3 CMS 4.7 and is a regression introduced with 57102904d645540a74d0519cfb8ebcc28fc20820

#12 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF