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.
Fc582698581884352e745d1d4c64699d?d=identicon&s=25 Joshua Muheim (josh)
on 2006-04-01 10: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
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-04-01 17:11
Hi!

There's probably simpler way, but you can always try
http://rmagick.rubyforge.org/.
Fc582698581884352e745d1d4c64699d?d=identicon&s=25 Joshua Muheim (josh)
on 2006-04-05 09: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()?
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-04-05 10:18
(Received via mailing list)
Joshua Muheim 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.