angelroyo he estado viendo tu código y la variable res sobra la forma mas facil seria:
Cita:
<?
$tex="Aqui texto [img]menugif.gif,150,200,left[/img] BLA BLE BLI BLO [img]menugif.gif,100,130,right[/img] Aqui mas texto";
$tex=preg_replace( "#\[img\](.*?),(.*?),(.*?),(.*?)\[/img\]#s", "<img src=\"\\1\" width=\"\\2\" height=\"\\3\" align=\"\\4\">", $tex );
echo "$tex";
?>
Saludos ;)
<img src=http://www.talleresdelweb.com/~mariojp/cool.gif align=left>Visita:<br> <a href=http://www.talleresdelweb.com target=_blank>Talleres del Web</a><br> <a href=http://www.mumu-weee.com target=_blank>Mumu Weee</a>