[TYPO3-project-seminars] Image of a seminar was not displayed in Detailview

Stefano Kowalke blueduck at gmx.net
Tue Feb 10 17:37:31 CET 2009


Hi,

i create a seminar record in the BE, give him a title, a image, speaker 
and manager.

In the list view all i want was displayed, but in the detail view, the 
image of the seminar was not shown.

After digging deeper and deeper i found the reason:

The image was insert in the <h2>-tag as a CSS background image.
<!-- ###FIELD_WRAPPER_TITLE### -->
	<h2
		<!-- ###FIELD_WRAPPER_IMAGE### -->
			###STYLE_SINGLEVIEWTITLE###
		<!-- ###FIELD_WRAPPER_IMAGE### -->
	>
	<!-- ###FIELD_WRAPPER_EVENT_TYPE### -->
		###EVENT_TYPE###:
	<!-- ###FIELD_WRAPPER_EVENT_TYPE### -->
	###TITLE###</h2>
<!-- ###FIELD_WRAPPER_TITLE### -->

The generated output looks like this:
<h2 style="background-image: url(http); background-repeat: no-repeat;"> 
  Title of the seminar</h2>

There was no path to the image in "url" - only http.


Now have a look to "class.tx_seminars_seminar".
Around line 4371 (in latest trunk) the function 
"createImageForSingleView" was defined.


Goto return, were the string was build together:

return ' style="' .
	'background-image: url(\'' . $imageFile[0][2] . '\'); ' .
			'background-repeat: no-repeat; ' .
			'padding-left: ' . $imageFile[0][4] . 'px; '.
			'height: ' . $imageFile[0][6] . 'px;"';

If i look into $imageFile with debug, i got this table:
   	
0 	img
1 	src
2 	http
3 	//domain.tld/typo3temp/pics/f2050f8b8c.jpg
4 	width
5 	160
6 	height
7 	160
8 	alt
9 	title

You can see, that the path is not fetched, only http from 
$imageFile[0][2], in $imageFile[0][4] was not the value for "padding" 
and in $imageFile[0][6] was not the value for "height".

I changed the code this way:

return ' style="' .
	'background-image: url(\'' . $imageFile[0][2] . ':' . 	
			$imageFile[0][3] . '\'); ' .
			'background-repeat: no-repeat; ' .
			//'padding-left: ' . $imageFile[0][4] . 'px; '.
			'height: ' . $imageFile[0][7] . 'px;"';

I don´t know why there is padding-left and from where i could get it, so 
i comment this out.



After these changes the image was displayed in the detailed view, but i 
think is was not the best way to display the image as a background image.

I would introduce a new marker "IMAGE_SEMINAR".

What would you say?

Cheers
Stefano


More information about the TYPO3-project-seminars mailing list