README.textile in fastimage-2.0.1 vs README.textile in fastimage-2.1.0

- old
+ new

@@ -35,10 +35,12 @@ 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'}@. FastImage can give you information about the parsed display orientation of an image with Exif data (jpeg or tiff). +FastImage also handles "Data URIs":https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs correctly. + h2. Security As of v1.6.7 FastImage no longer uses @openuri@ to open files, but directly calls @File.open@. Take care to sanitise the strings passed to FastImage; it will try to read from whatever is passed. h2. Examples @@ -60,10 +62,12 @@ => 432 FastImage.size("http://stephensykes.com/images/ss.com_x.gif", :http_header => {'User-Agent' => 'Fake Browser'}) => [266, 56] FastImage.new("http://stephensykes.com/images/ExifOrientation3.jpg").orientation => 3 +FastImage.size("data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==") +=> [1, 1] </code></pre> h2. Installation h4. Required Ruby version @@ -95,11 +99,11 @@ <pre lang="ruby"><code> irb> uri = "http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg" irb> puts Benchmark.measure {open(uri, 'rb') {|fh| p ImageSize.new(fh).size}} [9545, 6623] 0.680000 0.250000 0.930000 ( 7.571887) - + irb> puts Benchmark.measure {p FastImage.size(uri)} [9545, 6623] 0.010000 0.000000 0.010000 ( 0.090640) </code></pre> @@ -112,21 +116,21 @@ <pre lang="ruby"><code> irb> uri = "http://upload.wikimedia.org/wikipedia/commons/1/11/Shinbutsureijoushuincho.tiff" irb> puts Benchmark.measure {open(uri, 'rb') {|fh| p ImageSize.new(fh).size}} [1120, 1559] 1.080000 0.370000 1.450000 ( 13.766962) - + irb> puts Benchmark.measure {p FastImage.size(uri)} [1120, 1559] 3.490000 3.810000 7.300000 ( 11.754315) </code></pre> h2. Tests You'll need to @gem install fakeweb@ and possibly also @gem install test-unit@ to be able to run the tests. -bc.. $ ruby test.rb -Run options: +bc.. $ ruby test.rb +Run options: # Running tests: Finished tests in 1.033640s, 23.2189 tests/s, 82.2337 assertions/s. 24 tests, 85 assertions, 0 failures, 0 errors, 0 skips