Monday, May 16, 2011

Getting the Dimensions of a Flash (SWF) File rails


This is a just a quick post that will hopefully save some people a hell of a lot of time.
If you’re trying to get the width and height of a flash file, a banner for example, then you can use the ImageSpeclibrary by Brandon Anderson.
You can checkout the code with the following:
svn checkout http://ruby-imagespec.googlecode.com/svn/trunk/ vendor/plugins/ruby-imagespec
Then call it in your code to get the dimensions of a flash movie. Say you’re using Paperclip, then you could do the following:
dimensions = ImageSpec::Dimensions.new(@banner.file.path)
dimension.height # Get the height
dimesions.width # Get the width

No comments:

Post a Comment