some
[appoyo.git] / vendor / plugins / facebooker / lib / facebooker / rails / utilities.rb
blob8e9faa1ebe2d57a3e9b757aff1a4a3121d9c8cbf
1 module Facebooker
2   module Rails
3     class Utilities
4       class << self
5         def refresh_all_images(session)
6           Dir.glob(File.join(RAILS_ROOT,"public","images","*.{png,jpg,gif}")).each do |img|
7             refresh_image(session,img)
8           end
9         end
10         
11         def refresh_image(session,full_path)
12           basename=File.basename(full_path)
13           base_path=ActionController::Base.asset_host
14           base_path += "/" unless base_path.ends_with?("/")
15           image_path=base_path+"images/#{basename}"
16           puts "refreshing: #{image_path}"
17           session.server_cache.refresh_img_src(image_path)
18         end
19       end
20     end
21   end
22 end