jekyll-images 0.4.0rc1 → 0.4.0rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc71f657a7ea993a4d508a1d449f3c26c2494a0673784b8355c2e8d3ed3ae31c
4
- data.tar.gz: cb3aa8abcdfa1249defc513a420a285c5bd8375af45c3686f3f88dae59f67f63
3
+ metadata.gz: c8fb884679503e21d7cec255f22cd496b338ee6783b763249b94df7c9f719ec2
4
+ data.tar.gz: d2103b9d5ac82b643c5099e5a7f2a9ddb813951c81f429a0dd41822a4450e865
5
5
  SHA512:
6
- metadata.gz: b257a95b36f6a312d24221ad6c83c2cd2b42136441f9b128647bce4dcfc9fe7fa9b02eb281d48da524f97b0583bf74bcb4ae96db68015803f604fd64a653278a
7
- data.tar.gz: 81b8ddb8c50d25c78716aa00c60ffbb472ace6383df606f0d07af44dca25667c3099271ba819c8ba515429edbdd22efaad45edabe857e0ada5235b206c146858
6
+ metadata.gz: 106b016d8420dcd171cc7676715b3bf3ba6f272e0cd678f369b3b9f264697dd4734ba2d62b30ff532023553c0467abf37762c3f4945bb32b3c2f05a400ae8d81
7
+ data.tar.gz: e895b2a0c9f623050ab911dc829ce22696ee72a0477944c260cc1ff0a7396a2cbcb24b06c9c16ee0a737c5513c9fb6d577510c1c86d66b5dbe07809f13f41b1c
@@ -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)
@@ -26,6 +26,10 @@ module Jekyll
26
26
  def thumbnail(**args)
27
27
  @cached_thumbnails[args.hash.to_s] ||= Thumbnail.new site: site, filename: filename, image: self, **args
28
28
  end
29
+
30
+ def dzsave(**args)
31
+
32
+ end
29
33
  end
30
34
  end
31
35
  end
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.0rc1
4
+ version: 0.4.0rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
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