desc "compress and backup avatar" task :compress_avatar => :environment do path = File.join(Rails.root, "public/images/avatars/User") Dir.foreach(path) do |f| if f.to_s =~ /^\d+$/ puts f image = Trustie::Utils::Image.new(File.join(path,f), true) image.compress(300) end end end