Ciao, immagino che nella tua tabella del database ci sia un campo path che contenga l'effetiva locazione dell'immagine, e un campo nome_immagine che ne fa corrispondere il nome per la tua ricerca...
Codice PHP:
$strsql="Select path from tabella_immagini where nome_immagine='$immagine'";
$ris=mysql_query($strsql);
$riga=mysql_fetch_array($ris);
$testo="[img]".$riga["path"]"[/img]";
echo 
"<input type='text' name="immagine" value='$testo'"