i did somethin similar last week
i used to modify sp_articles function to catch and remove all images and first URL from article body
$corpodellarticolo = $article['msg']['body'];
$pattern = "/\[img(.*?)]([^\[]+)\[\/img]/i";
preg_match_all($pattern, $article['msg']['body'], $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
$imgs[] = $val[2];
$corpodellarticolo = str_replace($val[0],"",$corpodellarticolo);
}
$pattern = "/\[url(.*?)]([^\[]+)\[\/url]/i";
preg_match_all($pattern, $article['msg']['body'], $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
$urls[] = $val[0];
$corpodellarticolo = str_replace($val[0],"",$corpodellarticolo);
}
// trim all double breaks
for ($spazi = 0; $spazi < 10; $spazi++) {
$corpodellarticolo = str_replace("<br /><br />","<br />", $corpodellarticolo);
}
$article['msg']['body'] = $corpodellarticolo;
then I put catched URL and first image in the very first lines of body and let function go on
if ( isset($imgs) ) {
$article['msg']['body'] = '[img]'.$imgs[0].'[/img]<br />'.$article['msg']['body'];
unset($imgs);
}
if ( isset($urls) ) {
$article['msg']['body'] = $urls[0].'<br />'.$article['msg']['body'];
unset($urls);
}