jekyll-images 0.4.0rc0 → 0.4.0rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/jekyll/filters/dzsave.rb +33 -0
- data/lib/jekyll/images/image.rb +4 -0
- data/lib/jekyll/images/oxipng.rb +1 -1
- data/lib/jekyll-images.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda1839013f3926324b55c39851d9c3ed4bba23f40dfdb995499c0937303b986
|
4
|
+
data.tar.gz: d70705d09301fb8ef5092dc3480328a9119e9af9b9b6f57006804392c017b75b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88c86b1471440b7e6610e3bdb22e0bd11558a8f5f997f01db17447715e7a16a7177c5118530a4171846ceac4420774bc2ba706c1c7b2e940c6d463ece0b1caf0
|
7
|
+
data.tar.gz: 951d9ff05d72d7052bbbb395e4dbcd7dce1f0922df752cd0dafa41f4827c1512a445a4dc88ef9986af7df76759263c06fdbc1f4b0bfcca083a4ecbb0c95e32af
|
data/README.md
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Filters
|
5
|
+
# Liquid filter for use in templates
|
6
|
+
module Dzsave
|
7
|
+
# Generates an image pyramid
|
8
|
+
#
|
9
|
+
# @see {https://www.libvips.org/API/current/Making-image-pyramids.md.html}
|
10
|
+
def dzsave(input, layout = 'google', tile_size = 256)
|
11
|
+
return input unless input
|
12
|
+
|
13
|
+
path = @context.registers[:site].in_source_dir input
|
14
|
+
|
15
|
+
unless ::File.exist? path
|
16
|
+
Jekyll.logger.warn "File doesn't exist #{input}"
|
17
|
+
return input
|
18
|
+
end
|
19
|
+
|
20
|
+
dir = ::File.dirname(input)
|
21
|
+
image = Vips::Image.new_from_file path, access: :sequential
|
22
|
+
image.dzsave(dir, layout: layout, tile_size: tile_size)
|
23
|
+
|
24
|
+
"#{dir}/{z}/{y}/{x}.#{::File.extname input}"
|
25
|
+
rescue Vips::Error => e
|
26
|
+
Jekyll.logger.warn "Failed to process #{input}: #{e.message}"
|
27
|
+
input
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Liquid::Template.register_filter(Jekyll::Filters::Dzsave)
|
data/lib/jekyll/images/image.rb
CHANGED
data/lib/jekyll/images/oxipng.rb
CHANGED
@@ -9,7 +9,7 @@ module Jekyll
|
|
9
9
|
BINARY = 'oxipng'.freeze
|
10
10
|
|
11
11
|
def command
|
12
|
-
[binary, '--strip', 'all', '--quiet', '--interlace', (interlaced ?
|
12
|
+
[binary, '--strip', 'all', '--quiet', '--interlace', (interlaced ? %w[1 --force] : '0'), file].flatten
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/jekyll-images.rb
CHANGED
@@ -11,5 +11,6 @@ require_relative 'jekyll/images/thumbnail'
|
|
11
11
|
require_relative 'jekyll/filters/thumbnail'
|
12
12
|
require_relative 'jekyll/filters/width'
|
13
13
|
require_relative 'jekyll/filters/height'
|
14
|
+
require_relative 'jekyll/filters/dzsave'
|
14
15
|
require_relative 'jekyll/images/oxipng'
|
15
16
|
require_relative 'jekyll/images/jpeg_optim'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.0rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- LICENSE
|
65
65
|
- README.md
|
66
66
|
- lib/jekyll-images.rb
|
67
|
+
- lib/jekyll/filters/dzsave.rb
|
67
68
|
- lib/jekyll/filters/height.rb
|
68
69
|
- lib/jekyll/filters/thumbnail.rb
|
69
70
|
- lib/jekyll/filters/width.rb
|