3 # require File.dirname(__FILE__) + "/../config/environment"
6 User.where("image_use_gravatar AND id >=" + start.to_s).order("id").find_each do |user|
7 p "checked up to id " + user.id.to_s if user.id % 1000 == 0 # just give a rough indication where we are for restarting
8 next if user.image.present?
9 hash = Digest::MD5.hexdigest(user.email.downcase)
10 url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back
11 response = OSM.http_client.get(URI.parse(url))
12 user.image_use_gravatar = response.success?