convert_swf! method runs

This commit is contained in:
Emi Matchu 2011-05-13 08:00:34 -04:00
parent 6940e098d3
commit 883ecde836
7 changed files with 30 additions and 2 deletions

View file

@ -23,6 +23,8 @@ gem 'addressable', :require => ['addressable/template', 'addressable/uri']
gem 'whenever', '~> 0.6.2', :require => false gem 'whenever', '~> 0.6.2', :require => false
gem 'swf_converter', '~> 0.0.1'
group :development_async do group :development_async do
# async wrappers # async wrappers
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git' gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
@ -52,3 +54,4 @@ group :test do
gem 'factory_girl_rails', '~> 1.0' gem 'factory_girl_rails', '~> 1.0'
gem 'rspec-rails', '~> 2.0.0.beta.22' gem 'rspec-rails', '~> 2.0.0.beta.22'
end end

View file

@ -74,6 +74,7 @@ GEM
arel (2.0.8) arel (2.0.8)
bcrypt-ruby (2.1.4) bcrypt-ruby (2.1.4)
builder (2.1.2) builder (2.1.2)
chunky_png (1.2.0)
closure-compiler (1.0.0) closure-compiler (1.0.0)
compass (0.10.6) compass (0.10.6)
haml (>= 3.0.4) haml (>= 3.0.4)
@ -106,6 +107,8 @@ GEM
mime-types (1.16) mime-types (1.16)
msgpack (0.4.4) msgpack (0.4.4)
mysql2 (0.2.6) mysql2 (0.2.6)
oily_png (1.0.1)
chunky_png (~> 1)
openneo-auth-signatory (0.1.0) openneo-auth-signatory (0.1.0)
ruby-hmac ruby-hmac
polyglot (0.3.1) polyglot (0.3.1)
@ -143,6 +146,9 @@ GEM
rspec-rails (2.0.1) rspec-rails (2.0.1)
rspec (~> 2.0.0) rspec (~> 2.0.0)
ruby-hmac (0.4.0) ruby-hmac (0.4.0)
swf_converter (0.0.1)
chunky_png (~> 1.2.0)
oily_png (~> 1.0.1)
thin (1.2.7) thin (1.2.7)
daemons (>= 1.0.9) daemons (>= 1.0.9)
eventmachine (>= 0.12.6) eventmachine (>= 0.12.6)
@ -184,6 +190,7 @@ DEPENDENCIES
rails (= 3.0.4) rails (= 3.0.4)
rdiscount (~> 1.6.5) rdiscount (~> 1.6.5)
rspec-rails (~> 2.0.0.beta.22) rspec-rails (~> 2.0.0.beta.22)
swf_converter (~> 0.0.1)
thin (~> 1.2.7) thin (~> 1.2.7)
whenever (~> 0.6.2) whenever (~> 0.6.2)
will_paginate (~> 3.0.pre2) will_paginate (~> 3.0.pre2)

View file

@ -1,9 +1,25 @@
class SwfAsset < ActiveRecord::Base class SwfAsset < ActiveRecord::Base
PUBLIC_ASSET_DIR = File.join('swfs', 'outfit') PUBLIC_ASSET_DIR = File.join('swfs', 'outfit')
LOCAL_ASSET_DIR = Rails.root.join('public', PUBLIC_ASSET_DIR) LOCAL_ASSET_DIR = Rails.root.join('public', PUBLIC_ASSET_DIR)
PUBLIC_IMAGE_DIR = File.join('images', 'outfit')
LOCAL_IMAGE_DIR = Rails.root.join('public', PUBLIC_IMAGE_DIR)
NEOPETS_ASSET_SERVER = 'http://images.neopets.com' NEOPETS_ASSET_SERVER = 'http://images.neopets.com'
set_inheritance_column 'inheritance_type' set_inheritance_column 'inheritance_type'
include SwfConverter
converts_swfs :size => [600, 600], :output_sizes => [[150, 150], [300, 300], [600, 600]]
def local_swf_path
LOCAL_ASSET_DIR.join(local_path_within_outfit_swfs)
end
def swf_image_path(size)
base_dir = File.dirname(local_path_within_outfit_swfs)
image_dir = LOCAL_IMAGE_DIR.join(base_dir).join(id.to_s)
image_dir.join("#{id}_#{size[0]}x#{size[1]}.png")
end
attr_accessor :item attr_accessor :item
has_one :contribution, :as => :contributed has_one :contribution, :as => :contributed

2
public/images/outfit/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

BIN
vendor/cache/chunky_png-1.2.0.gem vendored Normal file

Binary file not shown.

BIN
vendor/cache/oily_png-1.0.1.gem vendored Normal file

Binary file not shown.

BIN
vendor/cache/swf_converter-0.0.1.gem vendored Normal file

Binary file not shown.