fastimage 2.2.6 → 2.2.7
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/version.rb +1 -1
- data/lib/fastimage.rb +28 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0365d74877c5c9bb640ef13fb701665b8fc511027ceba510be2cec62de03584c
|
4
|
+
data.tar.gz: d15af188ae269215bce75d21d1f796680bd66a488367ab9a935919b50fe10a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9b26747ff490133917388f29203c1d8272dfe88c28b9a5208a3df1a55728779c3cfe203784c6df9d1bca91bcf58df0cf64e60220a468a0c9f6ca4f47963b3e0
|
7
|
+
data.tar.gz: aa8f0a007f6cb710cbcea70241a56b9fd98fd54bb1a553be7c5533fca7b125b7df99ffbf5dcf5e996d87f60eb8a83933fd49aba848fc4a93c85ac540c8ae1577
|
data/README.textile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
!https://img.shields.io/gem/dt/fastimage.svg!:https://rubygems.org/gems/fastimage
|
2
|
-
!https://
|
2
|
+
!https://github.com/sdsykes/fastimage/actions/workflows/test.yml/badge.svg?branch=master!:https://github.com/sdsykes/fastimage/actions/workflows/test.yml
|
3
3
|
|
4
4
|
h1. FastImage
|
5
5
|
|
data/lib/fastimage/version.rb
CHANGED
data/lib/fastimage.rb
CHANGED
@@ -85,6 +85,8 @@ class FastImage
|
|
85
85
|
end
|
86
86
|
class CannotParseImage < FastImageException # :nodoc:
|
87
87
|
end
|
88
|
+
class BadImageURI < FastImageException # :nodoc:
|
89
|
+
end
|
88
90
|
|
89
91
|
DefaultTimeout = 2 unless const_defined?(:DefaultTimeout)
|
90
92
|
|
@@ -228,6 +230,8 @@ class FastImage
|
|
228
230
|
:size
|
229
231
|
end
|
230
232
|
|
233
|
+
raise BadImageURI if uri.nil?
|
234
|
+
|
231
235
|
@type, @state = nil
|
232
236
|
|
233
237
|
if uri.respond_to?(:read)
|
@@ -254,7 +258,7 @@ class FastImage
|
|
254
258
|
Errno::ENETUNREACH, ImageFetchFailure, Net::HTTPBadResponse, EOFError, Errno::ENOENT,
|
255
259
|
OpenSSL::SSL::SSLError
|
256
260
|
raise ImageFetchFailure if @options[:raise_on_failure]
|
257
|
-
rescue UnknownImageType
|
261
|
+
rescue UnknownImageType, BadImageURI
|
258
262
|
raise if @options[:raise_on_failure]
|
259
263
|
rescue CannotParseImage
|
260
264
|
if @options[:raise_on_failure]
|
@@ -431,7 +435,7 @@ class FastImage
|
|
431
435
|
|
432
436
|
def parse_animated
|
433
437
|
@type = parse_type unless @type
|
434
|
-
@type
|
438
|
+
%i(gif webp avif).include?(@type) ? send("parse_animated_for_#{@type}") : nil
|
435
439
|
end
|
436
440
|
|
437
441
|
def fetch_using_base64(uri)
|
@@ -547,6 +551,8 @@ class FastImage
|
|
547
551
|
case @stream.peek(12)[4..-1]
|
548
552
|
when "ftypavif"
|
549
553
|
:avif
|
554
|
+
when "ftypavis"
|
555
|
+
:avif
|
550
556
|
when "ftypheic"
|
551
557
|
:heic
|
552
558
|
when "ftypmif1"
|
@@ -1088,4 +1094,24 @@ class FastImage
|
|
1088
1094
|
gif = Gif.new(@stream)
|
1089
1095
|
gif.animated?
|
1090
1096
|
end
|
1097
|
+
|
1098
|
+
def parse_animated_for_webp
|
1099
|
+
vp8 = @stream.read(16)[12..15]
|
1100
|
+
_len = @stream.read(4).unpack("V")
|
1101
|
+
case vp8
|
1102
|
+
when "VP8 "
|
1103
|
+
false
|
1104
|
+
when "VP8L"
|
1105
|
+
false
|
1106
|
+
when "VP8X"
|
1107
|
+
flags = @stream.read(4).unpack("C")[0]
|
1108
|
+
flags & 2 > 0
|
1109
|
+
else
|
1110
|
+
nil
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
def parse_animated_for_avif
|
1115
|
+
@stream.peek(12)[4..-1] == "ftypavis"
|
1116
|
+
end
|
1091
1117
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Sykes
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-02-28 00:00:00.000000000 Z
|
@@ -82,7 +82,7 @@ homepage: http://github.com/sdsykes/fastimage
|
|
82
82
|
licenses:
|
83
83
|
- MIT
|
84
84
|
metadata: {}
|
85
|
-
post_install_message:
|
85
|
+
post_install_message:
|
86
86
|
rdoc_options:
|
87
87
|
- "--charset=UTF-8"
|
88
88
|
require_paths:
|
@@ -98,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
101
|
+
rubygems_version: 3.4.6
|
102
|
+
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: FastImage - Image info fast
|
105
105
|
test_files: []
|