Hi All, I have an image file (.jpg) that I can open via File.open() and I am curious on the easiest way to get the dimensions of this file. I''d prefer this to be a ruby/rails way and not a javascript method. Basically, I am looking for a way to verify that when a user uploads an image file that it is not larger than x by y. I''ve been looking around the web and I''m having trouble finding a way to do this. Also, if there is a way to just resize any image over some pre-defined size that would work as well. Thanks in advance, Ryan -- Ryan Prins rprins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://www.lazyi.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Look at: http://www.simplesystems.org/RMagick/doc/comtasks.html Ryan Prins wrote:> > Hi All, > > I have an image file (.jpg) that I can open via File.open() and I am > curious > on the easiest way to get the dimensions of this file. I''d prefer this to > be a ruby/rails way and not a javascript method. Basically, I am looking > for a way to verify that when a user uploads an image file that it is not > larger than x by y. I''ve been looking around the web and I''m having > trouble > finding a way to do this. Also, if there is a way to just resize any > image > over some pre-defined size that would work as well. > > Thanks in advance, > Ryan > > -- > Ryan Prins > rprins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://www.lazyi.net > > > > >-- View this message in context: http://www.nabble.com/-Rails--Get-Image-Dimensions-Given-Local-File-Path-tf2912107.html#a8136651 Sent from the RubyOnRails Users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try FlexImage http://beautifulpixel.com/flex_image/index.html It allows you to crop, resize, etc. checkout the RDoc link above, and see if that will work for you. Matt On Tue, 2007-01-02 at 22:55 -0800, Ryan Prins wrote:> Hi All, > > I have an image file (.jpg) that I can open via File.open() and I am > curious on the easiest way to get the dimensions of this file. I''d > prefer this to be a ruby/rails way and not a javascript method. > Basically, I am looking for a way to verify that when a user uploads > an image file that it is not larger than x by y. I''ve been looking > around the web and I''m having trouble finding a way to do this. Also, > if there is a way to just resize any image over some pre-defined size > that would work as well. > > Thanks in advance, > Ryan > > -- > Ryan Prins > rprins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://www.lazyi.net > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There are RoR plugins that allow you to resize and validate image uploads. Try the file_column plugin: http://www.kanthak.net/opensource/file_column/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---