(preg_match("@.*?(.*)@", $article['content'], $matches)) { $img = preg_replace("@height=\"\d+\"@", "", $img); $article['content'] = $matches[1]; $img = preg_replace("@width=\"\d+\"@", "", $img); $article['content'] = $this->get_img_tags($xpath, "//figure[@class='photo-hires-item']//img", $article); } // XKCD (alt tags we don't need to call out for elseif (strpos($article['content'], 'imgs.xkcd.com/comics/') !== FALSE) { $img = $matches[1]; } } // Three Panel Soul $xpath = new DOMXpath($doc); $imgs = $xpath->query('//img'); //doesn't get simpler than this foreach($imgs as $img){ // Questionable Content (cleanup Merge issues to be more robust and easier to adjust CV output range, switch between 5v and.