chrigu: fehler bei image erzeugung durch klasse

hallo zusammmen,
ich möchte gerne diagramme mit php erzeugen. dafür habe ich mir mal eine kleine klasse geschrieben, welche nur ein leeres bild erzeugt.. leider funktioniert diese nicht, mozilla meldet mir: "The image ****/test/bild1.php cannot be displayed, because it contains errors."

Hier der Code:

<?php
class diagramm
{
 var $dx;
 var $dy;
 var $img;

function create($dx = 300, $dy = 200)
 {
  $this->dx = $dx;
  $this->dy = $dy;
  $this->img = imageCreate($this->dx,$this->yx);
 }

function publish()
 {
          header("Content-Type: image/png\n\n");
                imagePng($this->img);
 }
}

$bild = new diagramm();
$bild->create();
$bild->publish();
?>

Gruss chrigu