echo preg_replace('/\[img\](.+?)\[\/img\]/e', '"<img src=\"\\1\" width=\"" . img_size("\\1", "width") . "\" height=\"" . img_size("\\1", "height") . "\"/>"', $texto);