33
Instead of getting everything but the images and then delete them, why don´t you try to get just the image with preg_match?
I´m using the following code to get images added with bbcode:
le="color: #000000"><?php if ($item['image'] == '') { $patterns = array(); $idx = array(); $patterns[0] = "/[img(.*)]([^"()?&'<>]*)[/img]/sU"; $idx[0] = 2; foreach ($patterns as $key => $pattern) { $matches = array(); preg_match($pattern, $item['description'], $matches); $image = @$matches[$idx[$key]]; if ($image != ''){ $item['image'] = $image; } unset($matches); } unset($patterns); unset($idx); }
Bad, bad xoops!
Quote:
$patterns[0] = "/\[img(.*)]([^\"\(\)\?\&'<>]*)\[\/img\]/sU";
So all you have to do is get a pattern for the images in html.
I hope Ghia can help you with this cause my knowledge of regex is zero.