Rails中检测SWF尺寸

Posted by devon on January 5th, 2009 filed in Rails应用

安装:

1
2
cd vendor/plugins
svn export http://ruby-imagespec.googlecode.com/svn/trunk/ image_spec

使用:

1
2
3
4
image = ImageSpec::Dimensions.new('/path/to/your/file')
 
image.width
image.height

例子:

1
2
3
4
5
6
>> image = ImageSpec::Dimensions.new("#{RAILS_ROOT}/a.swf")
=> #<ImageSpec::Dimensions:0x2570d94 @height=670, @width=868>
>> image.width
=> 868
>> image.height
=> 670

Related posts:

  1. Rails应用添加配置的方法 方法一: 使用 app_config 插件 script/plugin install http://svn.jarmark.org/rails/app_config Rails::Initializer.run do |config|...

Related posts brought to you by Yet Another Related Posts Plugin.

Leave a Comment