To fetch all images from html content: preg_match_all(‘/]+>/i’,$content, $images_src); & $imgsrc_regex = ‘#<\s*img [^\>]*src\s*=\s*([“\’])(.*?)\1#im’; Function to get attributes of img tag: function img_plain($html,$tag=’src’) { if (stripos($html, ‘<img’) !== false) { $imgsrc_regex = ‘#<\s*img [^\>]*’.$tag.’\s*=\s*([“\’])(.*?)\1#im’; preg_match($imgsrc_regex, $html, $matches); unset($imgsrc_regex); unset($html); if (is_array($matches) && !empty($matches)) { $img = $matches[2]; return $img; } else { return false; } […]