Forum: Ruby on Rails Determine image width of png, gif or jpg?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joshua M. (Guest)
on 2006-04-01 12:52
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
Szymon N. (Guest)
on 2006-04-01 19:11
Hi!

There's probably simpler way, but you can always try
http://rmagick.rubyforge.org/.
Joshua M. (Guest)
on 2006-04-05 11:13
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()?
Alex Y. (Guest)
on 2006-04-05 12:18
(Received via mailing list)
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 topic is locked and can not be replied to.