image_info 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/image_info/image.rb +13 -2
- data/lib/image_info/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc41310509a4e3d07a8e9a671875674e532f5e99
|
4
|
+
data.tar.gz: 8323109506dd885913623e9505dd5c51bddb0e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b4ddbece7f0a43cda5731cfddc80479112faec2cf7e1cdcdfb83a27f43092cd45634d2581eff2816f2bc85f78db6490e900745edef5d2ed1ab51f1e77d2320
|
7
|
+
data.tar.gz: 1551bf0913c31c88830b387b10c603c3ef0858add6f0a213f1222cc1fb6185f14f05b7c0b79911e2d5e197801e4e5f903b83ea0130820adb51584f686357899c
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
* 1.1.2
|
2
|
+
|
3
|
+
- Fix issues with schemaless uri (ex: `//foo.com`)
|
4
|
+
|
1
5
|
* 1.1.1
|
2
6
|
|
3
7
|
Now only fetch partial image data to compute its size and type.
|
4
8
|
|
5
9
|
Thanks to [vdaubry](https://github.com/vdaubry) the gem now uses typhoeus
|
6
10
|
stream capability to fetch images and get its size and type, aborting the
|
7
|
-
request if necessary. Make sure to use typhoeus
|
11
|
+
request if necessary. Make sure to use typhoeus `>= 0.7.3` in order to benefit
|
8
12
|
from this update since there was an issue with previous typhoeus version when
|
9
13
|
aborting ongoing requests.
|
10
14
|
|
data/lib/image_info/image.rb
CHANGED
@@ -7,7 +7,11 @@ module ImageInfo
|
|
7
7
|
attr_accessor :width, :height, :type
|
8
8
|
|
9
9
|
def initialize(uri)
|
10
|
-
@uri
|
10
|
+
@uri = ::URI.parse(::URI.encode(uri.to_s))
|
11
|
+
@uri.scheme = 'http' unless @uri.scheme
|
12
|
+
@uri.port = 80 unless @uri.port
|
13
|
+
rescue ::URI::InvalidURIError
|
14
|
+
@uri = NullUri.new
|
11
15
|
end
|
12
16
|
|
13
17
|
def size
|
@@ -15,7 +19,14 @@ module ImageInfo
|
|
15
19
|
end
|
16
20
|
|
17
21
|
def valid?
|
18
|
-
uri.
|
22
|
+
!!uri.host
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
class NullUri
|
28
|
+
def host
|
29
|
+
end
|
19
30
|
end
|
20
31
|
|
21
32
|
end
|
data/lib/image_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre-Louis Gottfrois
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|