How to find the dimensions of an uploaded image

Hi! I'm trying to make a site that can upload image files, but instead of posting each picture as their size, I'd rather post them in thumbnails (thank goodness html can warp images for you). I need to know how I can find a dimension of an image WITHOUT using a plugin (the server I am soon uploading this to most likely won't have that plugin...and I don't feel like forcing the administrators to download it). Are there any methods to take care of this?

Thanks!

I found some TCL code to do that here:

It shouldn't be too hard to port that to ruby. :slight_smile:

  - Tyler

Hi! I'm trying to make a site that can upload image files, but instead of posting each picture as their size, I'd rather post them in thumbnails (thank goodness html can warp images for you). I need to know how I can find a dimension of an image WITHOUT using a plugin (the server I am soon uploading this to most likely won't have that plugin...and I don't feel like forcing the administrators to download it). Are there any methods to take care of this?

This will work for most jpegs...

http://pastie.caboo.se/98119

Don't remember where I got it... probably off of pastie in the first place :slight_smile:

If you have other image types you could find code to handle those and work that in. PHP's getimagesize() method does most of them... and they all do it about the same way (read some bytes, do some math).

-philip

Hi, in addituion to what the others have posted, I would first check what plugins are available on the host.

Good luck,

-Conrad