Improve documentation

This commit is contained in:
sdsykes 2009-06-11 10:34:35 +03:00
parent c8a1f44112
commit a3291e48d6
2 changed files with 13 additions and 3 deletions

View File

@ -4,9 +4,11 @@ h4. FastImage finds the size or type of an image given its uri by fetching as li
h2. 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.
Your app needs to find the size or type of an image. This could be for adding width and height attributes to an image tag, for adjusting layouts or overlays to fit an image or any other of dozens of reasons.
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.
But the image is not locally stored - it's on another asset server, or in the cloud - at Amazon S3 for example.
You don't want to download the entire image to your app server - it 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.
@ -35,4 +37,11 @@ h2. Documentation
"http://rdoc.info/projects/sdsykes/fastimage":http://rdoc.info/projects/sdsykes/fastimage
(c) 2009 Stephen Sykes (sdsykes)
h2. References
* "http://pennysmalls.com/2008/08/19/find-jpeg-dimensions-fast-in-ruby/":http://pennysmalls.com/2008/08/19/find-jpeg-dimensions-fast-in-ruby/
* "http://snippets.dzone.com/posts/show/805":http://snippets.dzone.com/posts/show/805
* "http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/":http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/
* "http://imagesize.rubyforge.org/":http://imagesize.rubyforge.org/
(c) 2009 Stephen Sykes

View File

@ -20,6 +20,7 @@
# * http://snippets.dzone.com/posts/show/805
# * http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/
# * http://pennysmalls.com/2008/08/19/find-jpeg-dimensions-fast-in-ruby/
# * http://imagesize.rubyforge.org/
#
require 'net/https'