fastimage 1.9.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +8 -17
- data/lib/fastimage.rb +3 -4
- metadata +9 -10
- data/lib/fastimage/fbr.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d875303daa1b28112147473975032f3f81208c96
|
4
|
+
data.tar.gz: 3d89ef08e50f8aa11792de19776cb86daa85a98d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8026c5b308cd35dee11005123318cd1d19ec73f9da625014cef529e0855d570d1ba67618ecf4d2433239f699f6d2e2dcd9fc639c7ca4effe9c10d330d4ce3cb4
|
7
|
+
data.tar.gz: 871b33aaa246cd85b80bac5376826e941385d73c1f90e5b084b0977df7d441de39c3fe6661c681715cdf67fe24629795dec95eebb0456cafb6cd8e1b591cbdea
|
data/README.textile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
!https://img.shields.io/gem/dt/fastimage.svg!:https://rubygems.org/gems/fastimage
|
1
2
|
!https://travis-ci.org/sdsykes/fastimage.png?branch=master!:https://travis-ci.org/sdsykes/fastimage
|
2
3
|
|
3
4
|
h1. FastImage
|
@@ -67,6 +68,12 @@ FastImage.new("http://stephensykes.com/images/ExifOrientation3.jpg").orientation
|
|
67
68
|
|
68
69
|
h2. Installation
|
69
70
|
|
71
|
+
h4. Required Ruby version
|
72
|
+
|
73
|
+
FastImage version 2.0.0 and above work with Ruby 1.9.2 and above.
|
74
|
+
|
75
|
+
FastImage version 1.9.0 was the last version that supported Ruby 1.8.7.
|
76
|
+
|
70
77
|
h4. Gem
|
71
78
|
|
72
79
|
bc. gem install fastimage
|
@@ -124,13 +131,12 @@ Run options:
|
|
124
131
|
|
125
132
|
# Running tests:
|
126
133
|
|
127
|
-
Finished tests in 1.033640s, 23.2189 tests/s, 82.2337 assertions/s.
|
134
|
+
Finished tests in 1.033640s, 23.2189 tests/s, 82.2337 assertions/s.
|
128
135
|
24 tests, 85 assertions, 0 failures, 0 errors, 0 skips
|
129
136
|
|
130
137
|
h2. References
|
131
138
|
|
132
139
|
* "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/
|
133
|
-
* "DZone - Determine Image Size":http://snippets.dzone.com/posts/show/805
|
134
140
|
* "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/
|
135
141
|
* "imagesize gem":https://rubygems.org/gems/imagesize
|
136
142
|
* "EXIF Reader":https://github.com/remvee/exifr
|
@@ -147,18 +153,3 @@ h2. FastImage in other languages
|
|
147
153
|
h2. Licence
|
148
154
|
|
149
155
|
MIT, see file "MIT-LICENSE":MIT-LICENSE
|
150
|
-
|
151
|
-
h2. Contributors
|
152
|
-
|
153
|
-
Pull requests and suggestions are always welcome. Thanks to all the contributors!
|
154
|
-
|
155
|
-
* @felixbuenemann
|
156
|
-
* @speedmax
|
157
|
-
* @sebastianludwig
|
158
|
-
* @benjaminjackson
|
159
|
-
* @muffinista
|
160
|
-
* @marcandre
|
161
|
-
* @apanzerj
|
162
|
-
* @forresty
|
163
|
-
* kikihakiem
|
164
|
-
* lulalalalistia
|
data/lib/fastimage.rb
CHANGED
@@ -48,7 +48,6 @@
|
|
48
48
|
# => 3
|
49
49
|
#
|
50
50
|
# === References
|
51
|
-
# * http://snippets.dzone.com/posts/show/805
|
52
51
|
# * http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/
|
53
52
|
# * http://pennysmalls.wordpress.com/2008/08/19/find-jpeg-dimensions-fast-in-pure-ruby-no-ima/
|
54
53
|
# * https://rubygems.org/gems/imagesize
|
@@ -57,7 +56,6 @@
|
|
57
56
|
|
58
57
|
require 'net/https'
|
59
58
|
require 'addressable/uri'
|
60
|
-
require 'fastimage/fbr.rb'
|
61
59
|
require 'delegate'
|
62
60
|
require 'pathname'
|
63
61
|
require 'zlib'
|
@@ -200,8 +198,6 @@ class FastImage
|
|
200
198
|
end
|
201
199
|
end
|
202
200
|
|
203
|
-
uri.rewind if uri.respond_to?(:rewind)
|
204
|
-
|
205
201
|
raise SizeNotFound if @options[:raise_on_failure] && @property == :size && !@size
|
206
202
|
|
207
203
|
rescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET,
|
@@ -220,6 +216,9 @@ class FastImage
|
|
220
216
|
end
|
221
217
|
end
|
222
218
|
|
219
|
+
ensure
|
220
|
+
uri.rewind if uri.respond_to?(:rewind)
|
221
|
+
|
223
222
|
end
|
224
223
|
|
225
224
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fakeweb
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '10.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '10.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- MIT-LICENSE
|
92
92
|
- README.textile
|
93
93
|
- lib/fastimage.rb
|
94
|
-
- lib/fastimage/fbr.rb
|
95
94
|
homepage: http://github.com/sdsykes/fastimage
|
96
95
|
licenses:
|
97
96
|
- MIT
|
@@ -105,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
104
|
requirements:
|
106
105
|
- - ">="
|
107
106
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
107
|
+
version: 1.9.2
|
109
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
109
|
requirements:
|
111
110
|
- - ">="
|
data/lib/fastimage/fbr.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Poor Man's Fiber (API compatible Thread based Fiber implementation for Ruby 1.8)
|
2
|
-
# (c) 2008 Aman Gupta (tmm1)
|
3
|
-
|
4
|
-
unless defined? Fiber
|
5
|
-
require 'thread'
|
6
|
-
|
7
|
-
class FiberError < StandardError; # :nodoc:
|
8
|
-
end
|
9
|
-
|
10
|
-
class Fiber # :nodoc:
|
11
|
-
def initialize
|
12
|
-
raise ArgumentError, 'new Fiber requires a block' unless block_given?
|
13
|
-
|
14
|
-
@yield = Queue.new
|
15
|
-
@resume = Queue.new
|
16
|
-
|
17
|
-
@thread = Thread.new{ @yield.push [yield(*@resume.pop)] }
|
18
|
-
@thread.abort_on_exception = true
|
19
|
-
@thread[:fiber] = self
|
20
|
-
end
|
21
|
-
attr_reader :thread
|
22
|
-
|
23
|
-
def resume *args
|
24
|
-
raise FiberError, 'dead fiber called' unless @thread.alive?
|
25
|
-
@resume.push(args)
|
26
|
-
result = @yield.pop
|
27
|
-
result.size > 1 ? result : result.first
|
28
|
-
end
|
29
|
-
|
30
|
-
def yield *args
|
31
|
-
@yield.push(args)
|
32
|
-
result = @resume.pop
|
33
|
-
result.size > 1 ? result : result.first
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.yield *args
|
37
|
-
if fiber = Thread.current[:fiber]
|
38
|
-
fiber.yield(*args)
|
39
|
-
else
|
40
|
-
raise FiberError, 'not inside a fiber'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.current
|
45
|
-
if Thread.current == Thread.main
|
46
|
-
return Thread.main[:fiber] ||= RootFiber.new
|
47
|
-
end
|
48
|
-
|
49
|
-
Thread.current[:fiber] or raise FiberError, 'not inside a fiber'
|
50
|
-
end
|
51
|
-
|
52
|
-
def inspect
|
53
|
-
"#<#{self.class}:0x#{self.object_id.to_s(16)}>"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class RootFiber < Fiber # :nodoc:
|
58
|
-
def initialize
|
59
|
-
# XXX: what is a root fiber anyway?
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.yield *args
|
63
|
-
raise FiberError, "can't yield from root fiber"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|