README.textile in fastimage-1.3.0 vs README.textile in fastimage-1.3.1

- old
+ new

@@ -12,83 +12,79 @@ FastImage does this minimal fetch for image types GIF, JPEG, PNG and BMP. And it doesn't rely on installing external libraries such as RMagick (which relies on ImageMagick or GraphicsMagick) or ImageScience (which relies on FreeImage). You only need supply the uri, and FastImage will do the rest. +h2. Features + Fastimage can also read local (and other) files, and uses the open-uri library to do so. -And new in v1.2.9, FastImage will automatically read from any object that responds to :read - for +FastImage will automatically read from any object that responds to :read - for instance an IO object if that is passed instead of a URI. -New in v1.2.10 FastImage will follow up to 4 HTTP redirects to get the image. +FastImage will follow up to 4 HTTP redirects to get the image. +FastImage will obey the http_proxy setting in your environment to route requests via a proxy. + +You can add a timeout to the request which will limit the request time by passing :timeout => number_of_seconds. + +FastImage normally replies will nil if it encounters an error, but you can pass :raise_on_failure => true to get an exception. + h2. Examples -<pre> -<code> +<pre lang="ruby"><code> require 'fastimage' FastImage.size("http://stephensykes.com/images/ss.com_x.gif") => [266, 56] # width, height FastImage.type("http://stephensykes.com/images/pngimage") => :png FastImage.type("/some/local/file.gif") => :gif -</code> -</pre> +FastImage.size("http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg", :raise_on_failure=>true, :timeout=>0.1) +=> FastImage::ImageFetchFailure: FastImage::ImageFetchFailure +FastImage.size("http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg", :raise_on_failure=>true, :timeout=>2.0) +=> [9545, 6623] +</code></pre> h2. Installation h4. Gem -<pre> -<code> - gem install fastimage -</code> -</pre> +bc. gem install fastimage h4. Rails Install the gem as above, and add it to your Gemfile if you are using bundler, or configure it in your environment.rb file as below: -<pre> -<code> -... +<pre lang="ruby"><code> Rails::Initializer.run do |config| - ... config.gem "fastimage" - ... end -... -</code> -</pre> -Then you're off - just use FastImage.size() and FastImage.type() in your code as in the examples. +</code></pre> +Then you're off - just use @FastImage.size()@ and @FastImage.type()@ in your code as in the examples. h2. Documentation -"http://rdoc.info/projects/sdsykes/fastimage":http://rdoc.info/projects/sdsykes/fastimage +"http://sdsykes.github.io/fastimage/rdoc/FastImage.html":http://sdsykes.github.io/fastimage/rdoc/FastImage.html h2. Tests -You'll need to 'sudo gem install fakeweb' to be able to run the tests. +You'll need to @gem install fakeweb@ to be able to run the tests. -<pre> -<code> -ruby test/test.rb +bc.. ruby ./test/test.rb Loaded suite test/test Started ............... Finished in 0.059392 seconds. 15 tests, 27 assertions, 0 failures, 0 errors -</code> -</pre> - h2. References -* "http://pennysmalls.com/find-jpeg-dimensions-fast-in-pure-ruby-no-ima":http://pennysmalls.com/find-jpeg-dimensions-fast-in-pure-ruby-no-ima -* "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/ +* "Pennysmalls - Find jpeg dimensions fast in pure Ruby, no image library needed":http://pennysmalls.wordpress.com/2008/08/19/find-jpeg-dimensions-fast-in-pure-ruby-no-ima/ +* "DZone - Determine Image Size":http://snippets.dzone.com/posts/show/805 +* "Antti Kupila - 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/ +* "imagesize gem documentation":http://imagesize.rubyforge.org/ + h2. Licence -MIT, see file MIT_LICENCE +MIT, see file "MIT-LICENSE":MIT-LICENSE