Skip to content

Instantly share code, notes, and snippets.

@waitingallday
Created October 22, 2015 04:43
Show Gist options
  • Save waitingallday/592396a81edd665f8af2 to your computer and use it in GitHub Desktop.
Save waitingallday/592396a81edd665f8af2 to your computer and use it in GitHub Desktop.
This is what I used for featuring an image in the feed display ("today" tab), it matches the first image in the feed content body
recordset.each do |entry|
# Some other stuff
# ...
image_field = 'content' # 'description' in rss
unless entry[image_field].nil?
img = entry[image_field].match(/<img.+?src=[\"'](.+?)[\"'].*?>/)
unless img.nil?
item[:image] = raw.merge(img[1]).to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment