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

TrailsNH.com: Northeast Trail Conditions

TrailsNH.com is a pet project of mine that stems from my love of hiking, database, and web based technologies. The site is driven by bots I created to gather hiking trip reports and related information from all over the internet. The system GeoTags the location of each report, then indexes and organizes the information so hikers can find … Continue reading TrailsNH.com: Northeast Trail Conditions