| Funktion | Beispiel | Bedeutung |
| exif_imagetype($filename) | echo exif_imagetype ("logo.jpg"); | Bestimmt den Typ eines Bildes und gibt eine der Folgenden Konstanten aus:
1 = IMAGETYPE_GIF,
2 = IMAGETYPE_JPEG,
3 = IMAGETYPE_PNG,
4 = IMAGETYPE_SWF,
5 = IMAGETYPE_PSD,
6 = IMAGETYPE_BMP,
7 = IMAGETYPE_TIFF_II,
8 = IMAGETYPE_TIFF_MM,
9 = IMAGETYPE_JPC,
10 = IMAGETYPE_JP2,
11 = IMAGETYPE_JPX,
12 = IMAGETYPE_SWC.
Diese Funktion ist nur unter PHP 4 nutzbar, wenn es mit dem Zusatz --enable-exif kompiliert wurde. |
| gd_info() | print_r (gd_info()); | Gibt Informationen über die installierte GD-Bibliothek zurück. |
| getimagesize($filename [,$info]) | $arr = getimagesize("logo.jpg"); | Ermittelt die Bildeigenschaften einer GIF-, JPEG-, PNG- oder SWF-Grafik-Datei und gibt diese als Array $arr zurück.
$arr[0]: Bildbreite
$arr[1]: Bildhöhe
$arr[2]: Bildtyp - 1 = GIF, 2 = JPG, 3 = PNG, SWF = 4
$arr[3]: String "height=xxx width=xxx" zur Verwendung in einem <img>-Tag.
Das Array $info gibt optional zusätzliche Informationen zurück. |
| image_type_to_mime_type(imagetype) | header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG)); | Gibt dem MIME-Type für den Bildtyp aus, welcher von einer der Funktion getimagesize(), exif_read_data, exif_thumbnail oder exif_imagetype ermittelt wurde. Hier einige der Konstanten die zurück gegeben werden:
IMAGETYPE_GIF->image/gif
IMAGETYPE_JPEG->image/jpeg
IMAGETYPE_PNG->image/png
IMAGETYPE_PSD->image/psd
IMAGETYPE_BMP->image/bmp |
| imagearc($img, $cx, $cy, $w, $h, $s, $e, $col) | imagearc($bild, 100, 100, 50, 50, 0, 180, $farbe); | Zeichnet eine Ellipse mit dem Zentrum $cx/$cy, der Breite $w, der Höhe $h, dem Startwinkel $s und dem Endwinkel $e. |
| imagechar($img, $font, $x, $y, $char, $col) | imagechar($bild, $font, 100, 50, "Z", $col) ; | Zeichnet ein Zeichen $char. |
| imagecharup($img, $font, $x, $y, $char, $col) | imagecharup($bild, $font, 100, 50, "Z", $farbe) ; | Zeichnet ein um 90° gedrehtes Zeichen $char. |
| imagecolorallocate($img, $rot, $grün, $blau) | $col = imagecolorallocate($bild, 255, 0, 0); | Gibt ein Handle $col für eine Farbe zurück. |
| imagecolorat($img, $x, $y) | $col = imagecolorat($bild, 100, 100) ; | Gibt den Index $col des Farbwerts zu einem RGB-Wert zurück. |
| imagecolorresolve($img, $rot, $grün, $blau) | $col = imagecolorresolve($bild, 0, 255, 0); | Gibt den Index $col oder die nächste Farbe zu einem RGB-Wert zurück. |
| imagecolorset($img, $col, $rot, $grün, $blau) | $succ = imagecolorset($bild, $farbe, 0, 0, 255); | Änder eine Farbe $col innerhalb der Farbpalette. |
| imagecolorstotal($img) | $anzahl = imagecolorstotal($bild); | Gibt die Anzahl der im $img enthaltenen Farben zurück. |
| imagecolortransparent($img [,$col]) $col_n = | imagecolortransparent($bild) ; | Bestimmt eine Farbe als Transparent und gibt neues Handle $col_n zurück. Wird keine Farbe $col angegeben, wird die aktuelle verwendet. |
| imagecopyresized($dst_img, $src_img, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $scrW, $scrH) | imagecopyresized($Zielbild, $Quellbild, , , , , 0, 0, 0, 0); | Kopiert einen Bildausschnitt von $scr_img (Quelle) nach $dst_img (Ziel). |
| imagecreate($w,$h) | $img = imagecreate(400,400); | Erzeugt ein Bild mit dem Abmessungen $w (Breite) und $h (Höhe) und gibt ein Handle an $img zurück. |
| imagecreatefromjpeg($filename) $img = | imagecreatefromjpeg("logo.jpg"); | Erzeugt ein Bild aus einer JPEG-Datei und gibt ein Handle $img zurück. |
| imagecreatefrompng($filename) $img = | imagecreatefrompng("logo.png"); | Erzeugt ein Bild aus einer PNG-Datei und gibt ein Handle $img zurück. |
| imagedashedline($img, $x1, $y1, $x2, $y2, $col) | imagedashedline($bild, 0, 0, 100, 100, $farbe); | Zeichnet eine gestrichelte Linie. |
| imagedestroy($img) | imagedestroy($bild); | Gibt den von einem Bild belegten Speicher frei. |
| imagefill($img, $x, $y, $col); | imagefill($bild, 100,100,$farbe) ; | Füllt eine Fläche mit der Farbe $col. |
| imagefilledarc($img, $cx, $cy, $w, $h, $s, $e, $col,$style) | imagefilledarc($bild, 50, $i, 100, 50, 0, 45, $farbe, IMG_ARC_PIE); | Zeichnet eine gefüllte Ellipse mit dem Zentrum $cx/$cy, der Breite $w, der Höhe $h, dem Startwinkel $s und dem Endwinkel $e. Der Parameter $style kann folgende Werte annehmen:
IMG_ARC_PIE - Legt einen abgerundeten Rand fest.
IMG_ARC_CHORD - Verbindet Start- und Endwinkel mit einer Linie.
IMG_ARC_NOFILL - Keine Füllung lediglich Umrisslinien.
IMG_ARC_EDGED - Umrisslinien am Rand. |
| imagefilledellipse($img, $cx, $cy, $w, $h, $col) | imagefilledellipse($bild, 200, 150, 300, 200, $farbe); | Zeichnet eine gefüllte Ellipse mit dem Zentrum $cx/$cy, der Breite $w, der Höhe $h, dem Startwinkel $s und dem Endwinkel $e. |
| imagefilledpolygon($img, $points, $num, $col) | imagefilledpolygon($bild, $points, $num, $farbe) ; | Zeichnet ein mit der Farbe $col gefülltes Polygon mit $num Punkten. Die Punktkoordinaten sind im Array $points enthalten.
Points[0] = x0;
Points[1] = y0;
Points[2] = x1;
Points[3] = y1;
usw. |
| imagefilledrectangle($img, $x1, $y1, $x2, $y2, $col) | imagefilledrectangle($bild, {AusgabeReferenz}, {AusgabeReferenz}, 0, 0, $farbe); | Zeichnet ein gefülltes Rechteck.
|
| imagefilltoborder($img, $x, $y, $border, $col) | imagefilltoborder($bild, $x, $y, $border, $farbe) | Füllt eine Fläche, die durch die Farbe $col abgerenzt ist.
|
| imagefontheight($font) | $h = imagefontheight($font); | Gibt die Schrifthöhe einer Schriftart zurück.
|
| imagefontwidth($font) | $b = imagefontheight($font); | Gibt die Schriftbreite einer Schriftart zurück.
|
| imageinterlace($img [,$mode]) | imageinterlace($bild, 1); | Aktiviert oder deaktiviert den Interlaced Modus (1=an, 0=aus).
|
| imageline($img, $x1, $y1, $x2, $y2, $col) | imageline($bild, $x1, $y1, $x2, $y2, $farbe) ; | Zeichnet eine Linie.
|
| imageloadfont($filename) | imageloadfont(datei); | Lädt einen neuen Font (Schriftart) aus der Datei $filename.
|
| imagejpeg($img [, $filename [, $quality]]) | imagejpeg($bild, "test.jpg", 50); | Erzeugt ein JPEG-Bilddatei.
|
| imagepng($img [,$filename]) | imagepng($bild, "test.png"); | Erzeugt ein PNG-Bilddatei.
|
| imagepolygon($img, $points, $num, $col) | imagepolygon($bild, $points, $num, $farbe) ; | Zeichnet ein Polygon mit $num Punkten. Die Punktkoordinaten sind im Array $points enthalten.
Points[0] = x0;
Points[1] = y0;
Points[2] = x1;
Points[3] = y1;
usw. |
| imagepsbbox($text, $font, $size, $space, $width, $angle) | $array = imagepsbbox($text, $font, $size, $space, $width, $angle); | Gibt ein Array mit den Maßen einer Textbox zurück (PostScript Type-1-Font).
Array[0]: x1 (links unten)
Array[1]: y1 (links unten)
Array[2]: x2 (rechts oben)
Array[3]: y2 (rechts oben) |
| imagepsencodefont($endcodinfile) | imagepsendcodefont($endcoding); | Ändern den beschreibenden Vektor eines PostScript Type-1-Font. |
| imagepsfreefont($fontindex) | imagepsfreefont($index); | Gibt den von einem PostScript Type-1-Font belegten Speicher frei. |
| imagepsloadfont($filename) | imagepsloadfont($datei); | Lädt einen PostScript Type-1-Font aus einer Datei. |
| imagepstext($image, $text, $font, $size, $foreground, $background, $x, $y [, $space [, $tightness [, $angle [, $antialias_steps]]]]) | $array = imagepstext($image, $text, $font, $size, $foreground, $background, $x, $y [, $space [, $tightness [, $angle [, $antialias_steps]]]]); | Zeichnet einen String $text über einem Bild mit einem PostScript Type-1-Font und gibt ein Array $array mit den Maßen des erzeugten Text zurück. |
| imagerectangle($img, $x1, $y1, $x2, $y2, $col) | imagerectangle($bild, 100, 100, 200, 200, $farbe); | Zeichnet ein Rechteck. |
| imagesetpixel($img, $x, $y, $col) | imagesetpixel($bild, 100, 100, $farbe); | Setzt einen einzelnen Pixel. |
| imagestring($img, $font, $x, $y, $text, $col) | imagestring($bild, $font, $x, $y, "PHP", $farbe); | Schreibt einen Text $text. |
| imagestringup($img, $font, $x, $y, $text, $col) | imagestringup($bild, $font, $x, $y, "PHP", $farbe); | Schreibt einen vertikal ausgerichteten Text $text. |
| imagesx($img) | $b = imagesx($bild); | Gibt die Breite eines Bilds zurück. |
| imagesy($img) | $h = imagesy($bild); | Gibt die Höhe eines Bilds zurück. |
| imagettfbbox($size, $angle, $fontfile, $text) | $array = imagettfbbox($size, $angle, $fontfile, $text); | Gibt ein Array $array mit den Abmessungen einer Textbox mit TrueType-Fonts aus. |
| imagettftext($img, $size, $angle, $x, $y, $col, $fontfile, $text) | $array == imagettftext($bild, $size, $angle, $x, $y, $farbe, $fontfile, $text) | Zeichnet einen Text $text mit TrueType-Fonts und gibt ein Array $array mit den Abmessungen aus. |