jekyll-images 0.4.4 → 0.4.6
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 +2 -0
- data/lib/jekyll/filters/dzsave.rb +12 -5
- data/lib/jekyll/filters/height.rb +10 -1
- data/lib/jekyll/filters/max_zoom_level.rb +9 -1
- data/lib/jekyll/filters/thumbnail.rb +9 -1
- data/lib/jekyll/filters/width.rb +9 -1
- data/lib/jekyll/images/thumbnail.rb +15 -1
- data/lib/jekyll-images.rb +10 -5
- data.tar.gz.sig +0 -0
- metadata +31 -4
- metadata.gz.sig +3 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f11044a4db72b9c74f936c6fc0ba0f42e06bc397f0ad29c7d2a9c2b824036672
|
4
|
+
data.tar.gz: 0aed82cf05838262eaf1a44e081530121f9b84b4fd1cd5bf3f70a354e8570799
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da04dff846d5ae316dfcc4cc9d0bdb8e8622810095ca26f623ce238b05ec4f1ae53878e99b788866311cd3239bb79238b42b9d8ce42270163dd1998fad85da31
|
7
|
+
data.tar.gz: 2aaf220e457d3f9da9dc033ab915e402e693e858b511e2bbceeb1ac8200a6f5abfe8019bfa121fcc0d56f974abb37fec76881d01b9402a961156ec3a3bd8b1d7
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
]�.K^U ����p�h|��ٻd+# �g|p;�/_%�&��N�p�@�(E��Z�u���*eC�q�ǁ��uaq?��e¥��/x�jD���U�� (x��e�|�f��K�F����A����֩9j`����\Q=�
|
2
|
+
Y�a�a��]���B�üE z��8�O)�&�2��#gE$�Jү�| KCE�v״�b9��l�L��u�2�j�Q�k�@��k��z&�-D$]J���K$e����y��Ix���o�S^��ٿ}K)|}��X��<� �Ӭ`%yR|��Q��tU���,(4�ǡ�7"%zxG���2�(�;�LHh�{�UE�-&Iܯ��*֦�4��b�r�97
|
@@ -4,14 +4,21 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# Liquid filter for use in templates
|
6
6
|
module Dzsave
|
7
|
+
def self.jekyll_site=(site)
|
8
|
+
@@jekyll_site = site
|
9
|
+
end
|
10
|
+
|
11
|
+
def jekyll_site
|
12
|
+
@@jekyll_site
|
13
|
+
end
|
14
|
+
|
7
15
|
# Generates an image pyramid
|
8
16
|
#
|
9
17
|
# @see {https://www.libvips.org/API/current/Making-image-pyramids.md.html}
|
10
18
|
def dzsave(input, layout = 'google', tile_size = 256)
|
11
19
|
return input unless input
|
12
20
|
|
13
|
-
|
14
|
-
path = site.in_source_dir(input)
|
21
|
+
path = jekyll_site.in_source_dir(input)
|
15
22
|
|
16
23
|
unless ::File.exist?(path)
|
17
24
|
Jekyll.logger.warn "File doesn't exist #{input}"
|
@@ -21,16 +28,16 @@ module Jekyll
|
|
21
28
|
dir = ::File.dirname(input)
|
22
29
|
previous_tiles = []
|
23
30
|
|
24
|
-
Dir.chdir(
|
31
|
+
Dir.chdir(jekyll_site.source) do
|
25
32
|
previous_tiles = Dir.glob(::File.join(dir, '*', '**', '*.jpg'))
|
26
33
|
end
|
27
34
|
|
28
35
|
image = Vips::Image.new_from_file(path, access: :sequential)
|
29
36
|
image.dzsave(dir, layout: layout, tile_size: tile_size)
|
30
37
|
|
31
|
-
Dir.chdir(
|
38
|
+
Dir.chdir(jekyll_site.source) do
|
32
39
|
(Dir.glob(::File.join(dir, '*', '**', '*.jpg')) - previous_tiles).each do |tile|
|
33
|
-
|
40
|
+
jekyll_site.static_files << Jekyll::StaticFile.new(jekyll_site, jekyll_site.source, ::File.dirname(tile), ::File.basename(tile))
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
@@ -4,9 +4,18 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# Obtain image height
|
6
6
|
module Height
|
7
|
+
def self.jekyll_site=(site)
|
8
|
+
@@jekyll_site = site
|
9
|
+
end
|
10
|
+
|
11
|
+
def jekyll_site
|
12
|
+
@@jekyll_site
|
13
|
+
end
|
14
|
+
|
15
|
+
|
7
16
|
def height(input)
|
8
17
|
return unless input
|
9
|
-
path =
|
18
|
+
path = jekyll_site.in_source_dir input
|
10
19
|
|
11
20
|
unless ::File.exist? path
|
12
21
|
Jekyll.logger.warn "File doesn't exist #{input}"
|
@@ -4,6 +4,14 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# Maximum zoom level
|
6
6
|
module MaxZoomLevel
|
7
|
+
def self.jekyll_site=(site)
|
8
|
+
@@jekyll_site = site
|
9
|
+
end
|
10
|
+
|
11
|
+
def jekyll_site
|
12
|
+
@@jekyll_site
|
13
|
+
end
|
14
|
+
|
7
15
|
# Finds the maximum zoom level for an image
|
8
16
|
#
|
9
17
|
# @param :input [String]
|
@@ -11,7 +19,7 @@ module Jekyll
|
|
11
19
|
def max_zoom_level(input)
|
12
20
|
return input unless input
|
13
21
|
|
14
|
-
path = ::File.dirname(
|
22
|
+
path = ::File.dirname(jekyll_site.in_source_dir(input))
|
15
23
|
|
16
24
|
unless ::File.exist? path
|
17
25
|
Jekyll.logger.warn 'Max zoom level:', "File doesn't exist #{input}"
|
@@ -4,13 +4,21 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# Liquid filter for use in templates
|
6
6
|
module Thumbnail
|
7
|
+
def self.jekyll_site=(site)
|
8
|
+
@@jekyll_site = site
|
9
|
+
end
|
10
|
+
|
11
|
+
def jekyll_site
|
12
|
+
@@jekyll_site
|
13
|
+
end
|
14
|
+
|
7
15
|
# Generates a thumbnail and returns its alternate destination
|
8
16
|
def thumbnail(input, width = nil, height = nil, crop = nil, auto_rotate = nil)
|
9
17
|
return input unless input
|
10
18
|
return input if input.downcase.end_with? '.gif'
|
11
19
|
return input unless Jekyll.env == 'production'
|
12
20
|
|
13
|
-
path =
|
21
|
+
path = jekyll_site.in_source_dir input
|
14
22
|
|
15
23
|
unless ::File.exist? path
|
16
24
|
Jekyll.logger.warn "File doesn't exist #{input}"
|
data/lib/jekyll/filters/width.rb
CHANGED
@@ -4,9 +4,17 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# Obtain image width
|
6
6
|
module Width
|
7
|
+
def self.jekyll_site=(site)
|
8
|
+
@@jekyll_site = site
|
9
|
+
end
|
10
|
+
|
11
|
+
def jekyll_site
|
12
|
+
@@jekyll_site
|
13
|
+
end
|
14
|
+
|
7
15
|
def width(input)
|
8
16
|
return unless input
|
9
|
-
path =
|
17
|
+
path = jekyll_site.in_source_dir input
|
10
18
|
|
11
19
|
unless ::File.exist? path
|
12
20
|
Jekyll.logger.warn "File doesn't exist #{input}"
|
@@ -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
@@ -1,11 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'jekyll/images/cache'
|
4
|
-
|
5
|
-
Jekyll::Hooks.register :site, :after_reset do |site|
|
6
|
-
Jekyll::Images::Cache.site = site
|
7
|
-
end
|
8
|
-
|
9
4
|
require_relative 'jekyll/images/image'
|
10
5
|
require_relative 'jekyll/images/thumbnail'
|
11
6
|
require_relative 'jekyll/filters/thumbnail'
|
@@ -15,3 +10,13 @@ require_relative 'jekyll/filters/dzsave'
|
|
15
10
|
require_relative 'jekyll/filters/max_zoom_level'
|
16
11
|
require_relative 'jekyll/images/oxipng'
|
17
12
|
require_relative 'jekyll/images/jpeg_optim'
|
13
|
+
|
14
|
+
Jekyll::Hooks.register :site, :after_reset do |site|
|
15
|
+
Jekyll::Images::Cache.site =
|
16
|
+
Jekyll::Filters::Height.jekyll_site =
|
17
|
+
Jekyll::Filters::Thumbnail.jekyll_site =
|
18
|
+
Jekyll::Filters::Width.jekyll_site =
|
19
|
+
Jekyll::Filters::MaxZoomLevel.jekyll_site =
|
20
|
+
Jekyll::Filters::Dzsave.jekyll_site =
|
21
|
+
site
|
22
|
+
end
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEYDCCAsigAwIBAgIBATANBgkqhkiG9w0BAQsFADA7MQ4wDAYDVQQDDAVmYXVu
|
14
|
+
bzEVMBMGCgmSJomT8ixkARkWBXN1dHR5MRIwEAYKCZImiZPyLGQBGRY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sM3BNzwsPwDwIhYOu3Kc+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-04-17 00:00:00.000000000 Z
|
12
39
|
dependencies:
|
13
40
|
- !ruby/object:Gem::Dependency
|
14
41
|
name: jekyll
|
@@ -105,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
132
|
- !ruby/object:Gem::Version
|
106
133
|
version: '0'
|
107
134
|
requirements: []
|
108
|
-
rubygems_version: 3.3.
|
135
|
+
rubygems_version: 3.3.27
|
109
136
|
signing_key:
|
110
137
|
specification_version: 4
|
111
138
|
summary: Optimizes images for Jekyll
|
metadata.gz.sig
ADDED