I'm trying to figure out how to determine the width and height of images that are uploaded through my app. Either from the posted data or the file I save to disk. I've been searching around for info but no luck; I'm completely at a loss. Any suggestions or pointers would be great. Project background: The site is an artists portfolio site. The images are thumbnails and large pictures of her paintings. Rather then force her type in the width and height for every image I'd like to be able to detect those programmatically. - William
on 2006-01-29 08:54
on 2006-01-29 10:12
This will help you out. Just gotta parse out what you need. http://www.bigbold.com/snippets/tag/rmagick Google is your friend. Bob Silva http://www.railtie.net/
on 2006-01-29 19:00
That example requires rmagick. Is there a way to do this without extra modules? Thanks for the link. I found it once before, forgot to bookmark it, and was never able to find it again. From what I've seen, it looks like a good site.
on 2006-01-29 19:22
William LeFevre wrote: > That example requires rmagick. Is there a way to do this without extra > modules? > Not unless you want to write your own code to parse the information out of the image files... It's not too hard for most common file types, but it'd be far easier to get RMagick working, because that'll give you a way in to automatically generating thumbnails from originals, and so on. -- Alex
on 2006-01-29 19:27
> Not unless you want to write your own code to parse the information out > of the image files... That's what I'm after. Right now I don't need all image processing capabilities; I just need the width and height.
on 2006-01-29 19:37
Try this: http://www.bigbold.com/snippets/posts/show/805 It doesn't depend on rmagick; it parses the file headers instead.
on 2006-01-29 20:05
Sweet. That looks perfect. I'll dig into that tonight.
on 2006-01-30 02:31
On Jan 29, 2006, at 10:00 AM, William LeFevre wrote: > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > Try this: http://www.bigbold.com/snippets/posts/show/805 Cheers- -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper email@example.com 509-577-7732
on 2006-01-30 07:31
Looking at this code, doesn't it assume a certain "endian-ness"?