Merge pull request #42 from wildlyinaccurate/maintain-source-interlace
Maintain source image interlace mode
This commit is contained in:
commit
c8eb8c0c58
|
@ -38,6 +38,18 @@ Feature: Responsive image generation
|
||||||
And the file "assets/resized/subdir/test-100.png" should exist
|
And the file "assets/resized/subdir/test-100.png" should exist
|
||||||
And the file "_site/assets/resized/subdir/test-100.png" should exist
|
And the file "_site/assets/resized/subdir/test-100.png" should exist
|
||||||
|
|
||||||
|
Scenario: Honouring source image interlace mode
|
||||||
|
Given I have a responsive_image configuration with:
|
||||||
|
"""
|
||||||
|
template: _includes/responsive-image.html
|
||||||
|
sizes:
|
||||||
|
- width: 100
|
||||||
|
"""
|
||||||
|
|
||||||
|
And I have a file "index.html" with "{% responsive_image path: assets/progressive.jpeg %}"
|
||||||
|
When I run Jekyll
|
||||||
|
Then the image "assets/resized/progressive-100x50.jpeg" should be interlaced
|
||||||
|
|
||||||
Scenario: Honouring Jekyll 'source' configuration
|
Scenario: Honouring Jekyll 'source' configuration
|
||||||
Given I have copied my site to "my-site-copy/src"
|
Given I have copied my site to "my-site-copy/src"
|
||||||
And I have a configuration with:
|
And I have a configuration with:
|
||||||
|
|
|
@ -59,6 +59,12 @@ Then /^the image "(.+)" should have the dimensions "(\d+)x(\d+)"$/ do |path, wid
|
||||||
img.destroy!
|
img.destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the image "(.+)" should be interlaced$/ do |path|
|
||||||
|
img = Magick::Image::read(path).first
|
||||||
|
assert_equal Magick::JPEGInterlace, img.interlace
|
||||||
|
img.destroy!
|
||||||
|
end
|
||||||
|
|
||||||
def write_file(path, contents)
|
def write_file(path, contents)
|
||||||
File.open(path, 'w') do |f|
|
File.open(path, 'w') do |f|
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
|
@ -30,6 +30,7 @@ module Jekyll
|
||||||
|
|
||||||
i = img.scale(ratio)
|
i = img.scale(ratio)
|
||||||
i.write(site_source_filepath) do |f|
|
i.write(site_source_filepath) do |f|
|
||||||
|
f.interlace = i.interlace
|
||||||
f.quality = size['quality'] || config['default_quality']
|
f.quality = size['quality'] || config['default_quality']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue