---
title: "Bild wird gerendert, aber die Attribute nicht!"
url: "https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage"]
created: "2008-01-11"
last_reply: "2008-01-16"
replies: 8
solved: false
page: 1
pages: 1
lang: "de"
---

# Bild wird gerendert, aber die Attribute nicht!

Extensions › Entwicklung · 8 Antworten · gestartet 2008-01-11

## Eröffnungsbeitrag

**TheFreeman** · 2008-01-11 · [Beitrag #1](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/1)

Hallo,

ich habe das Problem, dass mein Bild zwar ausgegeben wird, aber die Größe wird nicht angepasst, wie ich es im TS vorgebe.

Die Ausgabe im Browser:

```html
<div class="hauptbild"><img src="uploads/tx_dskameraprofile/IMG_4896_web.jpg" width="300" height="240" border="0" alt="Canon / Kamera von Canon 1" title="Canon / Kamera von Canon 1" />
```

Mein TS:

```typoscript
plugin.tx_dskameraprofile_pi1 {
	mainImage{
		width = 100
		height = 100
	}
}
```

Mein PHP:

```php
$mainImgConf = $this->conf['mainImage.'];
$mainImgConf['file'] = 'uploads/tx_dskameraprofile/'.$resKamera['main_img'];
$mainImgConf['file.']['width'] = $mainImgConf['height'];
$mainImgConf['file.']['height'] = $mainImgConf['width'];
$mainImgConf['altText'] = $resManufac['manufacturer'].' / '.$resKamera['title'];
```

Der DEBUG vom **$mainImgConf** ist auch OK:

```html
width:	100
height:	100
file:	uploads/tx_dskameraprofile/IMG_4896_web.jpg
altText:Canon / Kamera von Canon 1
```

Was mache ich falsch? :o
Danke schonmal.

## Antworten

### [#2](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/2) · InforMedic · 2008-01-11

Bei mir tuts wie folgt:

```php
$filename = 'uk.gif';
// Non GIFBUILDER
$img = Array();
$img['file'] = 'typo3conf/ext/syslanguage_flags/gfx/'.$filename;
$img['file.']['width'] = 20;
$img['file.']['height'] = 12;
$img['file.']['maxW'] = 20;
$img['file.']['maxH'] = 12;
$img['altText'] = $title;
$img['titleText'] = $title;
$img['border'] = 1;
$image = $this->cObj->IMAGE($img);
```

gruß
Info

### [#3](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/3) · TheFreeman · 2008-01-13

Das ist schön.
Bei mir geht´s nicht. Und ich weiss nicht warum.
Ich hab auch nichts anderes als Du im PHP.
Und wie gesagt, wird das Bild ja auch ausgegeben.
Aber nicht so, wie ich es im TS vorschreibe.

Warum? #angry#

### [#4](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/4) · just2b · 2008-01-14

im debug vom conf sollte aber file => width und file => height stehen

georg

### [#5](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/5) · TheFreeman · 2008-01-14

OK, jetzt steht das so drin:

> width	100
> height	100
> file	uploads/tx_dskameraprofile/IMG_4896_web.jpg
> file.width	100
> file.height	100
> maxW	100
> maxH	100
> altText	Canon / Kamera von Canon 1

Aber es ändert sich nichts. #angry#
Ich bin am verzweifeln.

### [#6](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/6) · InforMedic · 2008-01-14

> **TheFreeman schrieb:**
>
> > width	100
> > height	100
> > file	uploads/tx_dskameraprofile/IMG_4896_web.jpg
> > file.width	100
> > file.height	100
> > maxW	100
> > maxH	100
> > altText	Canon / Kamera von Canon 1

Könntest du mal den phpcode posten? Mit der Angabe kann ich z.b. nicht nachvollziehen, ob dein Array auch dem Entspricht, wie es t3 benötigt ;-)

### [#7](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/7) · TheFreeman · 2008-01-15

Klar. Guggst Du :)

```php
$mainImgConf = $this->conf['mainImage.'];
$mainImgConf['file'] = 'uploads/tx_dskameraprofile/'.$resKamera['main_img'];
$mainImgConf['file.']['width'] = 100;
$mainImgConf['file.']['height'] = 100;
$mainImgConf['altText'] = $resManufac['manufacturer'].' / '.$resKamera['title'];
debug($mainImgConf);
```

In Zeile 3 und 4 habe ich die Werte mal so eingatragen zum testen. Jetzt steht im Array auf der ersten Ebene diese 2 Werte und auf der "file."-Ebene auch nochmal und trotzdem wird das Bild nicht verkleinert auf diese Werte.

Und hier mein TS:

```typoscript
plugin.tx_dskameraprofile_pi1 {
     mainImage{
	width = 100
	height = 100
     }
}
```

Passt das so? Ich denke schon, oder?

Acho so. Und die Ausgabe erfolgt dann hiermit:

```php
$this->cObj->IMAGE($mainImgConf)
```

### [#8](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/8) · digedag · 2008-01-16

Setzt doch mal **maxW** und/oder **maxH** mit in die Config rein.

Übrigens würdest du dir mit dieser TS-Config einige Zeilen PHP-Code ersparen.

```typoscript
plugin.tx_dskameraprofile_pi1 {
  mainImage {
    folder = uploads/tx_dskameraprofile/
    file {
      width = 100
      height = 100
      maxW = 100
      maxH = 100
    }
  }
}
```

Denn merke: Jede Zeile Code die du nicht programmierst, kann auch keine Fehler enthalten. :)

### [#9](https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht/9) · TheFreeman · 2008-01-16

Vielen lieben Dank Euch allen.
Jetzt funktioniert´s.  8-)

Mein TS:

```typoscript
#
plugin.tx_dskameraprofile_pi1 {
       mainImage{
		width = 276
		height = 0
		
		imageLinkWrap = 1
		imageLinkWrap {
			bodyTag = <body bgcolor="#A48068">
			wrap = <a href="javascript:close();"> | </a>
			width = 1024
			# height =			
			JSwindow = 1
			JSwindow.newWindow = 1
			JSwindow.expand = 17,20
			enable = 1
		}
	}
}
```

mein PHP:

```php
$mainImgConf = $this->conf['mainImage.'];
$mainImgConf['file'] = $imgPath.$resKamera['main_img'];
$mainImgConf['file.']['width'] = $mainImgConf['width'];
if($mainImgConf['height']>0){$mainImgConf['file.']['height'] = $mainImgConf['height'];}
$mainImgConf['altText'] = $resManufac['manufacturer'].' / '.$resKamera['title'];
$mainIMG = $this->cObj->IMAGE($mainImgConf);
```

---

Quelle: „Bild wird gerendert, aber die Attribute nicht!“, typo3.net, https://www.typo3.net/d/72351-bild-wird-gerendert-aber-die-attribute-nicht
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
