fastimage 2.4.0 → 2.4.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/README.md +4 -0
- data/lib/fastimage/fastimage_parsing/avif.rb +1 -0
- data/lib/fastimage/fastimage_parsing/heic.rb +1 -0
- data/lib/fastimage/fastimage_parsing/iso_bmff.rb +15 -5
- data/lib/fastimage/fastimage_parsing/type_parser.rb +6 -1
- data/lib/fastimage/version.rb +1 -1
- metadata +20 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67d8bb4b8d87e073cb5251387d5f73846849126eac20202cf964d5159afab120
|
|
4
|
+
data.tar.gz: 9e43de443fcaef8c4a99e76568a52adb74e06f6e59f361c0974bbebc56de6bcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c219a4b5df6301e3ce50e7731dd9cf0bca79a591635e31515f7535a5d9fc0386d69c0fa47a26bd25ea9dc0ff5ed960b66da3d99f28cd89acacf5640b65f2aadb
|
|
7
|
+
data.tar.gz: ba453f683cf2e68c9d7c9a4b741b0e77f2c6bd8f84fdb10685aba031c6114e008c94d3dbb4c08b883f72f5447fa9305cce558e4e12912f4d97eb2318b8438155
|
data/README.md
CHANGED
|
@@ -170,6 +170,10 @@ puts Benchmark.measure {p FastImage.size(uri)}
|
|
|
170
170
|
0.163443 0.214301 0.377744 ( 2.880414)
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
+
## Compatibility
|
|
174
|
+
|
|
175
|
+
FastImage requires Ruby 1.9.2 or later. It is tested on CI with Ruby 2.3 through 4.0.
|
|
176
|
+
|
|
173
177
|
## Tests
|
|
174
178
|
|
|
175
179
|
You'll need to bundle, or `gem install fakeweb` and possibly also `gem install test-unit` to be able to run the tests.
|
|
@@ -27,11 +27,11 @@ module FastImageParsing
|
|
|
27
27
|
read_boxes!
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
if [90, 270].include?(@rotation)
|
|
30
|
+
if @final_size && [90, 270].include?(@rotation)
|
|
31
31
|
@final_size.reverse!
|
|
32
32
|
end
|
|
33
|
-
|
|
34
|
-
@width, @height = @final_size
|
|
33
|
+
|
|
34
|
+
@width, @height = @final_size if @final_size
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
private
|
|
@@ -153,8 +153,18 @@ module FastImageParsing
|
|
|
153
153
|
def read_box_header!
|
|
154
154
|
size = read_uint32!
|
|
155
155
|
type = @stream.read(4)
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
if size == 1
|
|
157
|
+
size = read_uint64!
|
|
158
|
+
throw :finish if size < 16
|
|
159
|
+
[type, size - 16]
|
|
160
|
+
else
|
|
161
|
+
# size == 0 means the box extends to end of file (ISO/IEC 14496-12 §4.2).
|
|
162
|
+
# size < 8 is malformed (smaller than the header itself). Either way, no
|
|
163
|
+
# further boxes can be parsed at this level, so stop rather than looping
|
|
164
|
+
# on a non-advancing skip.
|
|
165
|
+
throw :finish if size < 8
|
|
166
|
+
[type, size - 8]
|
|
167
|
+
end
|
|
158
168
|
end
|
|
159
169
|
|
|
160
170
|
def read_uint8!
|
|
@@ -57,7 +57,12 @@ module FastImageParsing
|
|
|
57
57
|
# unknown. We assume the <svg tag cannot be within 10 chars of the end of
|
|
58
58
|
# the file, and is within the first 1000 chars.
|
|
59
59
|
begin
|
|
60
|
-
:svg if (1..100).
|
|
60
|
+
:svg if (1..100).any? { |n|
|
|
61
|
+
peeked = @stream.peek(10 * n)
|
|
62
|
+
svg_index = peeked.index("<svg")
|
|
63
|
+
html_index = peeked.index(/<html/i)
|
|
64
|
+
svg_index && (!html_index || svg_index < html_index)
|
|
65
|
+
}
|
|
61
66
|
rescue FiberError, FastImage::CannotParseImage
|
|
62
67
|
nil
|
|
63
68
|
end
|
data/lib/fastimage/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastimage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Sykes
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-10-24 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: fakeweb-fi
|
|
@@ -65,6 +66,20 @@ dependencies:
|
|
|
65
66
|
- - ">="
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
68
|
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: webrick
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
68
83
|
description: FastImage finds the size or type of an image given its uri by fetching
|
|
69
84
|
as little as needed.
|
|
70
85
|
email: sdsykes@gmail.com
|
|
@@ -101,6 +116,7 @@ homepage: http://github.com/sdsykes/fastimage
|
|
|
101
116
|
licenses:
|
|
102
117
|
- MIT
|
|
103
118
|
metadata: {}
|
|
119
|
+
post_install_message:
|
|
104
120
|
rdoc_options:
|
|
105
121
|
- "--charset=UTF-8"
|
|
106
122
|
require_paths:
|
|
@@ -116,7 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
116
132
|
- !ruby/object:Gem::Version
|
|
117
133
|
version: '0'
|
|
118
134
|
requirements: []
|
|
119
|
-
rubygems_version: 3.
|
|
135
|
+
rubygems_version: 3.4.10
|
|
136
|
+
signing_key:
|
|
120
137
|
specification_version: 4
|
|
121
138
|
summary: FastImage - Image info fast
|
|
122
139
|
test_files: []
|