Código PHP:
<?php
$image = "plantilla.png"; //plantilla
$im = imagecreatefrompng($image);
$blue = ImageColorAllocate ($im, 5, 50, 250); // Letra azul
$now = date("M d,Y H:i:s"); // Fecha, a incluir
$red = ImageColorAllocate ($im, 255, 0, 0); // Letra roja
$j = 8; // Modificar con valor de la consulta sobre $production
$space = $j*6+240;
ImageString($im, 3, 140, 5, " Jugador: $player ", $blue);
ImageString($im, 2, 140, 17, "growth: $growth science: $science", $blue);
ImageString($im, 2, 140, 30, "culture: $culture Production: $Production", $blue);
ImageString($im, 2, $space, 30, "Speed: $speed", $red);
ImageString($im, 2, 140, 40, "Atack: $atack Defense: $defense", $red);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
La pregunta que intento resolver es ¿Qué me falta para que se guarde la imagen en un directorio?