---
title: "Anfängerfrage Image einbauen"
url: "https://www.typo3.net/d/102949-anfaengerfrage-image-einbauen"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Bilder","Frage","PHP"]
created: "2010-12-17"
last_reply: "2010-12-27"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# Anfängerfrage Image einbauen

Extensions › Entwicklung · 2 Antworten · gestartet 2010-12-17

## Eröffnungsbeitrag

**lil-trick** · 2010-12-17 · [Beitrag #1](https://www.typo3.net/d/102949-anfaengerfrage-image-einbauen/1)

Hallo,

ich hab da mal ne Anfängerfrage, ich bau gerade etwas mit Typo3 herum.
Hab die Tabelle tt_content umd die Tabelle image_gallery erweitert.
Dort hab ich im Typo3 BE auf einer Seite 4 Bilder hochgeladen.

Nach etwas rumprobieren wurden mir auch die Bilder ausgegeben image01.jpg,image02.jpg,image03.jpg usw.

über nen explode konnte ich das Ganze auch schön in <li>image01.jpg</li> usw. umwandeln.

Aber wie bekomme ich jetzt den image Tag usw. um das Bild?

Kann mir da vielleicht mal einer helfen?

danke

```php
        function main($content,$conf)        {
                $this->conf = $conf;
                $this->pi_setPiVarDefaults();
                $this->pi_loadLL();
                $this->id=$GLOBALS['TSFE']->id;

        #Datensätze holen
        $res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
        '*',
        'tt_content',
        'hidden=0 and deleted=0 and pid='.$this->id,
        $groupBy='',
        $orderBy='',
        $limit='');
        
            while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                $image=$row['image_gallery'];
            }

	  $array = explode(",", $image);
  		for($i=0; $i < count($array); $i++) {
    			$content.="<li>" . $array[$i] . "</li>";
  		}
	 return $this->pi_wrapInBaseClass($content);
        }
```

## Antworten

### [#2](https://www.typo3.net/d/102949-anfaengerfrage-image-einbauen/2) · vince · 2010-12-17

Hallo,

wie wär's so:

```php
$path =  "/pfad/zu/den/bildern/";
for($i=0; $i < count($array); $i++) {
    $content.="<li><img src='" $path. $array[$i] . "'/></li>";
}
```

Dann ist zumindest schonmal der image Tag drinn.

Noch besser ist es, das ganze mit einem Template und Markern zu machen.

Gruß,
Vince.

### [#3](https://www.typo3.net/d/102949-anfaengerfrage-image-einbauen/3) · karlchen · 2010-12-27

nutze lieber die TYPO3 API dafür, somit kannst du die Bilder auch gleich skalieren

z.B.

```php
$path =  "/pfad/zu/den/bildern/";
$images = array();
$pictureConf = $this->conf['pictureConfiguration.'];

foreach ($pictures as $key => $picture) {
	$imageConf = array(
			'file' => $path . $picture['image'],
			'file.' => array(
				'maxW' =>  $pictureConf['maxW'],
				'maxH' =>  $pictureConf['maxH'],
			),
		);
	$images[] = $this->parentObj->cObj->IMAGE($imageConf);
	
}
```

im TypoScript kannst du dann alle Image Eigenschaften setzen die TYPO3 dir zur Verfügung stellt.

<https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Index.html>

```typoscript
plugin.tx_deineExtension_pi1{
	pictureConfiguration{
		maxW = 200
		maxH = 300
	}
}
```

---

Quelle: „Anfängerfrage Image einbauen“, typo3.net, https://www.typo3.net/d/102949-anfaengerfrage-image-einbauen
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
