jekyll-images 0.4.3 → 0.4.5
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
- checksums.yaml.gz.sig +0 -0
- data/lib/jekyll/filters/dzsave.rb +16 -3
- data/lib/jekyll/filters/max_zoom_level.rb +40 -0
- data/lib/jekyll/images/thumbnail.rb +15 -1
- data/lib/jekyll-images.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +32 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e619166d852ad3801e9aad3b4db7598d0ffa0f1a4df17155e8c728ee49fefb9a
|
4
|
+
data.tar.gz: 858e2a2e338219a2d9a4fd14acefb52d76c9216687eb77e84700511beb4afdd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e1ea089faa4d3caeab19bfaee7bf9599599061e4f2061a16656ae0b229cf154c0a6cb6f23b34b9b3674008c7c1da064bda092e21953db867952f2a36749eb1
|
7
|
+
data.tar.gz: 57fc3e27b9412b6073de6a2f64933411d438997ec60cff6c381cb164b690c6844e21a8589ed264867a152ca82aab605ddc3a5218c0146ff83486f182fd394499
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -10,17 +10,30 @@ module Jekyll
|
|
10
10
|
def dzsave(input, layout = 'google', tile_size = 256)
|
11
11
|
return input unless input
|
12
12
|
|
13
|
-
|
13
|
+
site = @context.registers[:site]
|
14
|
+
path = site.in_source_dir(input)
|
14
15
|
|
15
|
-
unless ::File.exist?
|
16
|
+
unless ::File.exist?(path)
|
16
17
|
Jekyll.logger.warn "File doesn't exist #{input}"
|
17
18
|
return input
|
18
19
|
end
|
19
20
|
|
20
21
|
dir = ::File.dirname(input)
|
21
|
-
|
22
|
+
previous_tiles = []
|
23
|
+
|
24
|
+
Dir.chdir(site.source) do
|
25
|
+
previous_tiles = Dir.glob(::File.join(dir, '*', '**', '*.jpg'))
|
26
|
+
end
|
27
|
+
|
28
|
+
image = Vips::Image.new_from_file(path, access: :sequential)
|
22
29
|
image.dzsave(dir, layout: layout, tile_size: tile_size)
|
23
30
|
|
31
|
+
Dir.chdir(site.source) do
|
32
|
+
(Dir.glob(::File.join(dir, '*', '**', '*.jpg')) - previous_tiles).each do |tile|
|
33
|
+
site.static_files << Jekyll::StaticFile.new(site, site.source, ::File.dirname(tile), ::File.basename(tile))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
24
37
|
"#{dir}/{z}/{y}/{x}.jpg"
|
25
38
|
rescue Vips::Error => e
|
26
39
|
Jekyll.logger.warn "Failed to process #{input}: #{e.message}"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Filters
|
5
|
+
# Maximum zoom level
|
6
|
+
module MaxZoomLevel
|
7
|
+
# Finds the maximum zoom level for an image
|
8
|
+
#
|
9
|
+
# @param :input [String]
|
10
|
+
# @return [Integer]
|
11
|
+
def max_zoom_level(input)
|
12
|
+
return input unless input
|
13
|
+
|
14
|
+
path = ::File.dirname(@context.registers[:site].in_source_dir(input))
|
15
|
+
|
16
|
+
unless ::File.exist? path
|
17
|
+
Jekyll.logger.warn 'Max zoom level:', "File doesn't exist #{input}"
|
18
|
+
return input
|
19
|
+
end
|
20
|
+
|
21
|
+
max_zoom_level = 0
|
22
|
+
|
23
|
+
loop do
|
24
|
+
unless ::File.directory?(::File.join(path, max_zoom_level.to_s))
|
25
|
+
max_zoom_level -= 1
|
26
|
+
break
|
27
|
+
end
|
28
|
+
|
29
|
+
break if max_zoom_level > 18
|
30
|
+
|
31
|
+
max_zoom_level += 1
|
32
|
+
end
|
33
|
+
|
34
|
+
max_zoom_level
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Liquid::Template.register_filter(Jekyll::Filters::MaxZoomLevel)
|
@@ -7,6 +7,11 @@ module Jekyll
|
|
7
7
|
class Thumbnail
|
8
8
|
attr_reader :site, :filename, :image, :width, :height, :crop, :auto_rotate
|
9
9
|
|
10
|
+
EXT_MAP = {
|
11
|
+
'.heic' => '.jpg',
|
12
|
+
nil => '.jpg'
|
13
|
+
}.freeze
|
14
|
+
|
10
15
|
def initialize(site:, filename:, image:, **args)
|
11
16
|
if args.slice(:width, :height).values.none?
|
12
17
|
raise ArgumentError, "#{filename} thumbnail needs width or height"
|
@@ -58,8 +63,17 @@ module Jekyll
|
|
58
63
|
image.width > width
|
59
64
|
end
|
60
65
|
|
66
|
+
# Return the same address, unless we're mapping to something else
|
67
|
+
#
|
68
|
+
# @return [String]
|
61
69
|
def extname
|
62
|
-
@extname ||=
|
70
|
+
@extname ||=
|
71
|
+
begin
|
72
|
+
ext = File.extname(filename)
|
73
|
+
ext = nil if ext.empty?
|
74
|
+
|
75
|
+
EXT_MAP[ext] || ext
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
# Only write when the source is newer than the thumbnail
|
data/lib/jekyll-images.rb
CHANGED
@@ -12,5 +12,6 @@ require_relative 'jekyll/filters/thumbnail'
|
|
12
12
|
require_relative 'jekyll/filters/width'
|
13
13
|
require_relative 'jekyll/filters/height'
|
14
14
|
require_relative 'jekyll/filters/dzsave'
|
15
|
+
require_relative 'jekyll/filters/max_zoom_level'
|
15
16
|
require_relative 'jekyll/images/oxipng'
|
16
17
|
require_relative 'jekyll/images/jpeg_optim'
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,41 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
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
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFIH0kjcsF7inzAwy488EEY5thfpiMBkGA1Ud
|
27
|
+
EQQSMBCBDmZhdW5vQHN1dHR5Lm5sMBkGA1UdEgQSMBCBDmZhdW5vQHN1dHR5Lm5s
|
28
|
+
MA0GCSqGSIb3DQEBCwUAA4IBgQCEo4E1ZAjlzw7LeJlju4BWUvKLjrbGiDNBYQir
|
29
|
+
lmyHhYXWV3gnozs08sM3BNzwsPwDwIhYOu3Kc+36DtEpKToUxqEGbsxX8uGzyp88
|
30
|
+
HTlaNsaHCZBeB2wgUYcIeO2lKdNu+V9WxfTRhYu+02OfLRv65qSfm6uck1Ml1Cg/
|
31
|
+
tn1Y7mLHSdnWPZCQhQZA0wX/SFL64DeozAwJLhYtKneU/m5PEqv9nNnJVCLlbODB
|
32
|
+
zFTjbsKtpWxNN+xWsJbjukggS8uX1400WqyjUCitDxDJknP+xeAg8wt2wT+IC1X1
|
33
|
+
zMY8gjxoBfwPum74cBTaZzYMpeGaS1fJ3N4NBU+SHLRDiKaVZzEnoNyJDHnsXXrX
|
34
|
+
MvF98+bTUHC9xcklH7RCO5uqUOq7cxIcMjzx3cpR6+AW6zXYQBjWfNB9KfaAstZy
|
35
|
+
cpurTQHNJfL/ah+9dYbgDXdG5HAAjRMAsWSvERw95YdN9XzQZCdUk5wUs+A6cNtO
|
36
|
+
AZZUMTVYNx8JqUeemxlXBRjsD/s=
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
12
39
|
dependencies:
|
13
40
|
- !ruby/object:Gem::Dependency
|
14
41
|
name: jekyll
|
@@ -66,6 +93,7 @@ files:
|
|
66
93
|
- lib/jekyll-images.rb
|
67
94
|
- lib/jekyll/filters/dzsave.rb
|
68
95
|
- lib/jekyll/filters/height.rb
|
96
|
+
- lib/jekyll/filters/max_zoom_level.rb
|
69
97
|
- lib/jekyll/filters/thumbnail.rb
|
70
98
|
- lib/jekyll/filters/width.rb
|
71
99
|
- lib/jekyll/images/cache.rb
|
@@ -104,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
132
|
- !ruby/object:Gem::Version
|
105
133
|
version: '0'
|
106
134
|
requirements: []
|
107
|
-
rubygems_version: 3.3.
|
135
|
+
rubygems_version: 3.3.27
|
108
136
|
signing_key:
|
109
137
|
specification_version: 4
|
110
138
|
summary: Optimizes images for Jekyll
|
metadata.gz.sig
ADDED
Binary file
|