fastimage 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +1 -1
- data/lib/fastimage.rb +8 -8
- metadata +37 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a02b98b4a5111c9df579f8fb6a04fd28e46aeeae
|
4
|
+
data.tar.gz: b88b2fb0d0b343d42d7de8a431fa94e0db3c8f86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34fc61b9355c98f017626b9e7359075d95c6247ac9f20d53e5f2484c450546aa76c23214c37f6844df69939910b94715686600a676bfb867fe7f3aa8a770c480
|
7
|
+
data.tar.gz: 75809b1269410e5be54bb89104008c4e8350f4df63439306c325abc52a10e0232b52cffb0a818b1bb1fcda71cbf23d5725490c14701c95f02ddc010ecce264c7
|
data/README.textile
CHANGED
@@ -16,7 +16,7 @@ You only need supply the uri, and FastImage will do the rest.
|
|
16
16
|
|
17
17
|
h2. Features
|
18
18
|
|
19
|
-
Fastimage can also read local (and other) files, and uses the
|
19
|
+
Fastimage can also read local (and other) files, and uses the Addressable library to do so.
|
20
20
|
|
21
21
|
FastImage will automatically read from any object that responds to :read - for
|
22
22
|
instance an IO object if that is passed instead of a URI.
|
data/lib/fastimage.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# FastImage knows about GIF, JPEG, BMP, TIFF and PNG files.
|
12
12
|
#
|
13
13
|
# FastImage can also read files from the local filesystem by supplying the path instead of a uri.
|
14
|
-
# In this case FastImage uses the
|
14
|
+
# In this case FastImage uses the Addressable library to read the file in chunks of 256 bytes until
|
15
15
|
# it has enough. This is possibly a useful bandwidth-saving feature if the file is on a network
|
16
16
|
# attached disk rather than truly local.
|
17
17
|
#
|
@@ -41,7 +41,7 @@
|
|
41
41
|
#
|
42
42
|
|
43
43
|
require 'net/https'
|
44
|
-
require '
|
44
|
+
require 'addressable/uri'
|
45
45
|
require 'fastimage/fbr.rb'
|
46
46
|
|
47
47
|
class FastImage
|
@@ -161,8 +161,8 @@ class FastImage
|
|
161
161
|
fetch_using_read(uri)
|
162
162
|
else
|
163
163
|
begin
|
164
|
-
@parsed_uri = URI.parse(uri)
|
165
|
-
rescue URI::InvalidURIError
|
164
|
+
@parsed_uri = Addressable::URI.parse(uri)
|
165
|
+
rescue Addressable::URI::InvalidURIError
|
166
166
|
fetch_using_open_uri
|
167
167
|
else
|
168
168
|
if @parsed_uri.scheme == "http" || @parsed_uri.scheme == "https"
|
@@ -209,14 +209,14 @@ class FastImage
|
|
209
209
|
if res.is_a?(Net::HTTPRedirection) && @redirect_count < 4
|
210
210
|
@redirect_count += 1
|
211
211
|
begin
|
212
|
-
newly_parsed_uri = URI.parse(res['Location'])
|
212
|
+
newly_parsed_uri = Addressable::URI.parse(res['Location'])
|
213
213
|
# The new location may be relative - check for that
|
214
214
|
if newly_parsed_uri.scheme != "http" && newly_parsed_uri.scheme != "https"
|
215
215
|
@parsed_uri.path = res['Location']
|
216
216
|
else
|
217
217
|
@parsed_uri = newly_parsed_uri
|
218
218
|
end
|
219
|
-
rescue URI::InvalidURIError
|
219
|
+
rescue Addressable::URI::InvalidURIError
|
220
220
|
else
|
221
221
|
fetch_using_http_from_parsed_uri
|
222
222
|
break
|
@@ -239,8 +239,8 @@ class FastImage
|
|
239
239
|
|
240
240
|
def proxy_uri
|
241
241
|
begin
|
242
|
-
proxy = ENV['http_proxy'] && ENV['http_proxy'] != "" ? URI.parse(ENV['http_proxy']) : nil
|
243
|
-
rescue URI::InvalidURIError
|
242
|
+
proxy = ENV['http_proxy'] && ENV['http_proxy'] != "" ? Addressable::URI.parse(ENV['http_proxy']) : nil
|
243
|
+
rescue Addressable::URI::InvalidURIError
|
244
244
|
proxy = nil
|
245
245
|
end
|
246
246
|
proxy
|
metadata
CHANGED
@@ -1,15 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
-
dependencies:
|
11
|
+
date: 2013-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
- - '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.3.5
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.3'
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.3.5
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: fakeweb
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
13
47
|
description: FastImage finds the size or type of an image given its uri by fetching
|
14
48
|
as little as needed.
|
15
49
|
email: sdsykes@gmail.com
|