Determine image width of png, gif or jpg?


#1

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


#2

Hi!

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


#3

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()?


#4

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…