Determine image width of png, gif or jpg?

Hi all

In PHP I have a neat function:

http://ch2.php.net/function.getimagesize

With it I can easily determine the dimensions of an image file. How can
I do that in RoR?

Thanks for help. Greets,
Josh

Hi!

There’s probably simpler way, but you can always try
http://rmagick.rubyforge.org/.

szymek wrote:

Hi!

There’s probably simpler way, but you can always try
http://rmagick.rubyforge.org/.

Thanks, but isn’t there something like a helper method like PHP’s
get_image_size()?

Joshua M. wrote:

szymek wrote:

Hi!

There’s probably simpler way, but you can always try
http://rmagick.rubyforge.org/.

Thanks, but isn’t there something like a helper method like PHP’s
get_image_size()?

There’s nothing built-in, but you can get dimensions for jpg, gif and
png easily enough:

http://www.bigbold.com/snippets/posts/show/805

Other image types could probably be handled relatively easily, too…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs