Browse Source

allow portrait orientation for thumbnails

fix #531
pull/543/head
Simon Conseil 5 months ago
parent
commit
cc4bf0360b
  1. 1
      docs/changelog.rst
  2. 2
      src/sigal/settings.py
  3. 8
      tests/test_settings.py

1
docs/changelog.rst

@ -16,6 +16,7 @@ Sigal now requires Python 3.11+.
- Fix theme URL for photoswipe.
- Thumbnail can now be set in ``index.md`` either with the original filename or
with the thumbnail name after format conversion [:issue:`476`].
- Allow portrait orientation for thumbnails [:issue:`531`].
Version 2.5
~~~~~~~~~~~

2
src/sigal/settings.py

@ -194,7 +194,7 @@ def read_settings(filename=None):
settings[p] = abspath(normpath(join(settings_path, path)))
logger.debug("Rewrite %s : %s -> %s", p, path, settings[p])
for key in ("img_size", "thumb_size", "video_size"):
for key in ("img_size", "video_size"):
if settings[key]:
w, h = settings[key]
if h > w:

8
tests/test_settings.py

@ -36,10 +36,14 @@ def test_img_sizes(tmpdir):
"""Test that image size is swaped if needed."""
conf = tmpdir.join("sigal.conf.py")
conf.write("thumb_size = (150, 200)")
conf.write(
"img_size = (600, 800)\n"
"thumb_size = (150, 200)"
)
settings = read_settings(str(conf))
assert settings["thumb_size"] == (200, 150)
assert settings["img_size"] == (800, 600)
assert settings["thumb_size"] == (150, 200)
def test_theme_path(tmpdir):

Loading…
Cancel
Save