sdsykes / fastimage
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (6)
- Wiki (1)
- Graphs
-
Tag:
v1.0.1
commit c8a1f44112266b37b4834cff4cf5275d069d1bf3
tree 7241cb63d285bde8c5c05c1f6178d11c9945b363
parent e1a2ab4c601cd8f6d6c7cb1df43b63bc54d022e0
tree 7241cb63d285bde8c5c05c1f6178d11c9945b363
parent e1a2ab4c601cd8f6d6c7cb1df43b63bc54d022e0
| name | age | message | |
|---|---|---|---|
| |
README | ||
| |
README.textile | ||
| |
Rakefile | ||
| |
VERSION.yml | ||
| |
fastimage.gemspec | ||
| |
lib/ |
README.textile
FastImage
FastImage finds the size or type of an image given its uri by fetching as little as needed
The problem
Your app needs to find the size or type of an image. But the image is not locally stored – it’s on another server, or in the cloud – at Amazon S3 for example.
You don’t want to download the entire image, which could be many tens of kilobytes, or even megabytes just to get this information. For most image types, the size of the image is simply stored at the start of the file. For JPEG files it’s a little bit more complex, but even so you do not need to fetch most of the image to find the size.
FastImage does this minimal fetch for image types GIF, JPEG, PNG and BMP.
You only need supply the uri, and FastImage will do the rest.
Examples
require 'fastimage'
FastImage.size("http://stephensykes.com/images/ss.com_x.gif")
=> [266, 56] # width, height
FastImage.type("http://stephensykes.com/images/pngimage")
=> :png
Installation
Gem
sudo gem install sdsykes-fastimage -s http://gems.github.comDocumentation
http://rdoc.info/projects/sdsykes/fastimage
© 2009 Stephen Sykes (sdsykes)

