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|...
  2. Rails PDF 输出 Rails中生成PDF有多种办法,HTMLDOC命令(可配合HTML,CSS将页面转成PDF)、PDF::Writer、Ruby FPDF。本文以Ruby FPDF为例,讲解如何在Rails输出中英文的PDF文档。 1, 安装 railsrfpdf 插件 ruby script/plugin install...

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

Leave a Comment