hi ich generiere in meiner extension einen img tag.
Der wie folg ausschaut
$image = '<img src="' . $imagePfad . '"/>';
$maker['###IMAGE###'] = $image;
Das Bild wir auch dargestellt, jetzt will ich das wenn man auf das Bild klickt das das Bild vergrößert dargestellt wird.
Manche meinen das sollte automatisch gehen das tut es jedenfalls bei mir nicht.
Wie soll ich vorgehen?
das ist sowieso nicht der richtige Weg um Bilder auszugeben.
Richtig ist es mit $this->cObj->IMAGE und einem entsprechenden conf-Array. Klickvergrösserung läuft über imageLinkWrap.
https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Image/Index.html
gut habe jetzt folgendes gemacht
function getImageCode($imgName){
$conf = array(
"file" => "uploads/tx_abfachbeitraege/".$imgName ,
'file.' => array (
'maxW' => "auto",
'maxH' => "auto"
)
);
return $this->cObj->IMAGE($conf);
}
wie kann ich jetzt die alt und title tags des bildes noch setzen?
und habe im TS folgendes noch gemacht
page.1.imageLinkWrap = 1
page.1.imageLinkWrap.enable = 1
Nur das mit dem vergrößern klappt immer nocht nicht,weshalb?
schau den Link an - da stehen die parameter alle !
Das das TS nicht greift ist doch klar, das hat nichts mit Deinem conf-Array zu tun. Du musst Deinem Array schon ein eigenes imageLinkWrap-Array zufügen.
ok habe es jetzt in die extension als funktion hineingeschrieben
function getImageEnlargeConf($imgPfad) {
$tmpconf['JSwindow'] = 1;
$tmpconf['bodyTag'] = '';
$tmpconf['JSwindow.']['newWindow'] = 0;
$tmpconf['JSwindow.']['expand'] = '17,20';
$tmpconf['enable'] = 1;
$tmpconf['wrap'] = '<A href="javascript:close();"> | </A>';
$tmpconf['width'] = 800;
$tmpconf['height'] = 600;
$wrap = '<p></p>';
return $this->cObj->imageLinkWrap($wrap,$imgPfad,$tmpconf);
}
Theoretisch müsste jetzt diese Funktion mein img Tag zurückgeben
welches ich auch später Enlargen kann oder?
Leider tut es dies nicht
gut habe das problem gelöst, falls jemand das problem haben sollte hier die lösung:
$image = $this->getImageCode($imagePfad);
$image = $this->getImageEnlargeConf($image,$imagePfad);
#zum test
echo $image;
Die Funktion getImageCode
function getImageCode($imgName){
$conf = array(
"file" => "uploads/tx_mabPlugin/".$imgName ,
'file.' => array (
'maxW' => "auto",
'maxH' => "auto"
)
);
return $this->cObj->IMAGE($conf);
}
Die Funktion getImageEnlargeConf
function getImageEnlargeConf($image,$imgPfad) {
$tmpconf['JSwindow'] = 1;
$tmpconf['bodyTag'] = '<body style="margin:0px;padding:0px;">';
$tmpconf['JSwindow.']['newWindow'] = 0;
$tmpconf['JSwindow.']['expand'] = '20,20';
$tmpconf['enable'] = 1;
$tmpconf['wrap'] = '<A href="javascript:close();"> | </A>';
$tmpconf['width'] = 800;
$tmpconf['height'] = 600;
$wrap = '<p></p>';
$obj = new tslib_cObj();
$res = $obj->imageLinkWrap($image,$imgPfad,$tmpconf);
return $res;
}