Zum Inhalt springen

Bild wird gerendert, aber die Attribute nicht!

Erstellt am 11. Januar 2008 · 8 Antworten · letzte Antwort am 16. Januar 2008

Tags: Frage

TheFreeman ·

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:

<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:

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

Mein 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:

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.

InforMedic ·

Bei mir tuts wie folgt:

$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

TheFreeman ·

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#

TheFreeman ·

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.

InforMedic ·
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 ;-)

TheFreeman ·

Klar. Guggst Du 🙂

$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:

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

Passt das so? Ich denke schon, oder?

Acho so. Und die Ausgabe erfolgt dann hiermit:

$this->cObj->IMAGE($mainImgConf)
digedag ·

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.

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. 🙂

TheFreeman ·

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

Mein TS:

#
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:

$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);