Ciao a tutti,

vorrei poter modificare una immagine già esistente aggiungendogli del testo e successivamente poterla visualizzare, con il seguente script sono riuscito a modificarla ma non riesco a capire come poterla visualizzare in un tag img sulla pagina html.
codice:
// Set the content-type
header('Content-Type: image/png');

// Create the image
//$im = imagecreatetruecolor(400, 30);
$im = imagecreatefrompng("http://localhost/miacartella/myimage.PNG");

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = "Testo...";
// Replace path by your own font path
$font = '/miacartella/Verdana_Grassetto.ttf';

// Add some shadow to the text
imagettftext($im, 15, 0, 141, 71, $grey, $font, $text);

// Add the text
imagettftext($im, 15, 0, 140, 70, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
//imagedestroy($im);
Il mio scopo finale sarebbe quello di recuperare una stringa da un form e visualizzare l'immagine modificata con tale stringa nella pagina successiva in un tag img, e magari riuscire a modificare il nome dell'immagine in modo che sia uguale alla stringa.

Qualcuno ha idea di come si possa fare?

Grazie a tutti in anticipo.