Parsing HTML5 IMG srcset

I needed a simple function to use in a TrailsNH Bot to find the largest image in an HTML5 srcset. Here’s what I came up with. function getLargestImage($srcsetString){ $images = array(); // split on comma $srcsetArray = explode(“,”, $srcsetString); foreach($srcsetArray as $srcString){ // split on whitespace – optional descriptor $imgArray = explode(” “, trim($srcString)); // … Continue reading Parsing HTML5 IMG srcset