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).zero? # just give a rough indication where we are for restarting
8 next if user.image.present?
10 hash = Digest::MD5.hexdigest(user.email.downcase)
11 url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back
12 response = OSM.http_client.get(URI.parse(url))
13 user.image_use_gravatar = response.success?