jekyll-responsive_image 1.0.0.pre → 1.0.0.pre2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d18be51a4b9c530086c42b4f419c3bb6739e67bf
|
4
|
+
data.tar.gz: b647f5b9735d163daa0ff72383b3e43b180fcb0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ab03f2be21e24f7e4a6360c6fddac96398ce85575714075ce7628b8a3c0542240179705859144a609a8ce426ed382bbe91ba27b8d5f1f26385a77aba9c2c97
|
7
|
+
data.tar.gz: 1d081bb80050e2acc3f8d36ecfd36841084869eeaca0cd24ed9c7595af38d56d183c90203e8b8bfea389c99b73b9d8c9189a474ea63f89df25b83c2badc03093
|
@@ -22,8 +22,8 @@ module Jekyll
|
|
22
22
|
site = context.registers[:site]
|
23
23
|
config = make_config(site)
|
24
24
|
|
25
|
-
|
26
|
-
image = ImageProcessor.process(
|
25
|
+
absolute_image_path = site.in_source_dir(attributes['path'].to_s)
|
26
|
+
image = ImageProcessor.process(absolute_image_path, attributes['path'], config)
|
27
27
|
attributes['original'] = image[:original]
|
28
28
|
attributes['resized'] = image[:resized]
|
29
29
|
|
@@ -7,8 +7,10 @@ module Jekyll
|
|
7
7
|
config = make_config(site)
|
8
8
|
|
9
9
|
config['extra_images'].each do |pathspec|
|
10
|
-
Dir.glob(site.in_source_dir(pathspec)) do |
|
11
|
-
|
10
|
+
Dir.glob(site.in_source_dir(pathspec)) do |image_path|
|
11
|
+
relative_image_path = image_path.sub(/^#{Regexp.escape(image_path)}/, '')
|
12
|
+
|
13
|
+
result = ImageProcessor.process(image_path, relative_image_path, config)
|
12
14
|
result[:resized].each { |image| keep_resized_image!(site, image) }
|
13
15
|
end
|
14
16
|
end
|
@@ -3,20 +3,20 @@ module Jekyll
|
|
3
3
|
class ImageProcessor
|
4
4
|
include ResponsiveImage::Utils
|
5
5
|
|
6
|
-
def process(
|
7
|
-
raise SyntaxError.new("Invalid image path specified: #{
|
6
|
+
def process(absolute_image_path, relative_image_path, config)
|
7
|
+
raise SyntaxError.new("Invalid image path specified: #{absolute_image_path}") unless File.file?(absolute_image_path)
|
8
8
|
|
9
9
|
resize_handler = ResizeHandler.new
|
10
|
-
img = Magick::Image::read(
|
10
|
+
img = Magick::Image::read(absolute_image_path).first
|
11
11
|
|
12
12
|
{
|
13
|
-
original: image_hash(config['base_path'],
|
13
|
+
original: image_hash(config['base_path'], relative_image_path, img.columns, img.rows),
|
14
14
|
resized: resize_handler.resize_image(img, config),
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.process(
|
19
|
-
self.new.process(
|
18
|
+
def self.process(absolute_image_path, relative_image_path, config)
|
19
|
+
self.new.process(absolute_image_path, relative_image_path, config)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|