README.textile in fastimage-1.7.0 vs README.textile in fastimage-1.8.0

- old
+ new

@@ -32,10 +32,12 @@ FastImage normally replies will nil if it encounters an error, but you can pass :raise_on_failure => true to get an exception. FastImage also provides a reader for the content length header provided in HTTP. This may be useful to assess the file size of an image, but do not rely on it exclusively - it will not be present in chunked responses for instance. +FastImage accepts additional HTTP headers. This can be used to set a user agent or referrer which some servers require. Pass an :http_header argument to specify headers, e.g., :http_header => {'User-Agent' => 'Fake Browser'}. + h2. Security As of v1.6.7 FastImage no longer uses openuri to open files, but directly calls File.open. But take care to sanitise the strings passed to FastImage; it will try to read from whatever is passed. h2. Examples @@ -53,10 +55,12 @@ => 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] FastImage.new("http://stephensykes.com/images/pngimage").content_length => 432 +FastImage.size("http://stephensykes.com/images/ss.com_x.gif", :http_header => {'User-Agent' => 'Fake Browser'}) +=> [266, 56] </code></pre> h2. Installation h4. Gem @@ -64,9 +68,11 @@ bc. gem install fastimage h4. Rails Add fastimage to your Gemfile, and bundle. + +bc. gem 'fastimage' Then you're off - just use @FastImage.size()@ and @FastImage.type()@ in your code as in the examples. h2. Documentation