Commit graph

40 commits

Author SHA1 Message Date
Vojtech Kral
6f22132b8d
imgproc: Don't upscale images in the Fit op, fix a bug in comment in #1542 (#1545)
* imgproc: Don't upscale images in the Fit op, fix  #1542

* imgproc: Remove FIXMEs that have been addressed
2021-07-07 11:15:37 +02:00
Vincent Prouillet
38ddb1c4d1 cargo fmt 2021-06-10 10:26:12 +02:00
Vojtech Kral
9145af6b3e imageproc things for paths refactor (#1484)
* Move image loading code used by get_image_metadata from templates to imageproc

* resize_image: Compute image resize op beforehand and return metadata to caller

* get_image_metdata: Use a serializable response struct

* imageproc: Add integration tests

* imageproc: Assume webp is lossy

* get_image_metadata: Use webp crate for decoding WebP, image is still not very good at it

* imageproc: Test read_image_dimensions in integration tests

* imageproc: Rename read_image_dimensions() as read_image_metadata()

* imageproc: Fix a regression in hash computation

* imageproc: Don't hardcode hashes in integration tests, pattern match them instead

* imageproc: Style fixes

* imageproc: Fix integration tests on Windows (hopefully)
2021-06-10 10:26:12 +02:00
Vincent Prouillet
7fb99eaa44 Revamp the images template functions 2021-06-10 10:26:12 +02:00
Jason Miller
421a2512f7
Hash collision using the same quality level and incorrect quality for WebP (#1431)
* fix: webp quality level mismatch

* fix: hash collision using the same image ops

Using the same image operations, but for different formats, e.g. `.jpg` and
`.webp`, produced the same hash.

To differentiate between these, the image extension is added to the hash.
2021-04-18 11:07:10 +02:00
Vincent Prouillet
fc808f2aa8 Some clippy fixes 2021-04-07 22:13:15 +02:00
Vincent Prouillet
3262f69bb0 Single compute_hash fn + cargo fmt 2021-02-20 14:07:36 +01:00
Philip Kristoffersen
8eac5a5994
WebP support in resize_image (#1360)
* Removing unused webpl

* Adding clarification comment

* Updating documentation

* Adding webp
2021-02-18 22:30:10 +01:00
Vincent Prouillet
0d5fefd446 Update image to 0.23 2020-02-10 20:48:52 +01:00
Sam Ford
e804f907b2 Use Rust 2018 edition (#885) 2020-02-02 17:48:43 -08:00
Vincent Prouillet
8e3f1f59f6 Update Tera 2020-02-02 17:48:43 -08:00
Vincent Prouillet
243702e2c2 Update tera 2020-02-02 17:45:16 -08:00
Tjeu Kayim
6149fd17e1 Skip anchor checking for URL with prefix in config (#812)
* cargo fmt & clippy

* Skip anchor checking for URL with prefix in config
2020-02-02 17:45:16 -08:00
Arne Beer
f96aad2fdd Only shrink when resizing with fit (#803) 2019-09-24 16:54:14 -07:00
Vincent Prouillet
b396a1bc20 Add --drafts flag + rustfmt 2019-08-24 22:23:08 +02:00
Vincent Prouillet
e74dab535d Update deps & re-render on anchor-link.html changes
Closes #719
2019-08-08 00:37:38 +02:00
traviscross
46ee256ba4 Fix clippy warnings (#744)
Clippy is returning some warnings.  Let's fix or explicitly ignore
them.  In particular:

- In `components/imageproc/src/lib.rs`, we implement `Hash` explicitly
  but derive `PartialEq`.  We need to maintain the property that two
  keys being equal implies the hashes of those two keys are equal.
  Our `Hash` implementations preserve this, so we'll explicitly ignore
  the warnings.

- In `components/site/src/lib.rs`, we were calling `.into()` on some
  values that are already of the correct type.

- In `components/site/src/lib.rs`, we were using `.map(|x| *x)` in
  iterator chains to remove a level of indirection; we can instead say
  `.copied()` (introduced in Rust v1.36) or `.cloned()`.  Using
  `.copied` here is better from a type-checking point of view, but
  we'll use `.cloned` for now as Rust v1.36 was only recently
  released.

- In `components/templates/src/filters.rs` and
  `components/utils/src/site.rs`, we were taking `HashMap`s as
  function arguments but not generically accepting alternate `Hasher`
  implementations.

- In `src/cmd/check.rs`, we use `env::current_dir()` as a default
  value, but our use of `unwrap_or` meant that we would always
  retrieve the current directory even when not needed.

- In `components/errors/src/lib.rs`, we can use `if let` rather than
  `match`.

- In `components/library/src/content/page.rs`, we can collapse a
  nested conditional into `else if let ...`.

- In `components/library/src/sorting.rs`, a function takes `&&Page`
  arguments.  Clippy warns about this for efficiency reasons, but
  we're doing it here to match a particular sorting API, so we'll
  explicitly ignore the warning.
2019-07-12 22:54:18 +02:00
Jakub Wieczorek
b716401217 Fix warnings caused by unnecessary mut qualifiers (#735) 2019-07-12 22:54:18 +02:00
Vincent Prouillet
df720a5baf Update deps 2019-06-21 09:24:14 +02:00
Vincent Prouillet
cb962f7a64 Add aliases to sections 2019-06-02 20:21:06 +02:00
Vincent Prouillet
9bc675f2a7 Fix colocated dates + rustfmt
Closes #607
2019-02-09 19:54:47 +01:00
Vincent Prouillet
1e2dd9ce03 Update tera to v1 alpha 2019-01-23 19:20:43 +01:00
Vincent Prouillet
e119b68533 Remove earlier/later/lighter/heavier from pages when rendering sections 2019-01-21 17:55:05 +01:00
Vincent Prouillet
5caf24f06c Remove error-chain
Closes #576
2019-01-17 14:31:47 +01:00
Vincent Prouillet
832360f9b1 Update deps + rustfmt 2019-01-02 20:41:29 +01:00
Vojtech Kral
9bd6a559c1 imageproc: Use Lanczos3 filter instead of Gaussian 2018-12-28 01:41:22 +01:00
Vojtech Kral
6e84eec32b imageproc: Add the format option, support for PNG thumbnails
Fix #546
2018-12-28 01:41:22 +01:00
Vincent Prouillet
b7ce4e59fb rustfmt 2018-10-31 08:18:57 +01:00
Vincent Prouillet
f5c88540ed Update reqwest and image 2018-09-30 19:17:51 +02:00
Vincent Prouillet
62b89d0c72 _processed_images -> processed_images 2018-09-15 13:16:46 +02:00
Thomas Hurst
088b3df79a Replace fold/reduce over Result::and with collect
Not only is this tidier, but it avoids making these iterators
Rayon-specific.
2018-09-13 19:17:05 +01:00
Vincent Prouillet
60a52fd2cc Some intellij reformatting 2018-07-31 15:30:49 +02:00
Vincent Prouillet
1ae0702494
Custom taxonomies (#330) 2018-07-16 10:54:05 +02:00
Vincent Prouillet
d47ba4aff0 Rebasing + tweaks 2018-06-25 19:13:21 +02:00
Vojtech Kral
17de3c9a97 imageproc: Rename _resized_images as _processed_images 2018-06-25 18:09:45 +02:00
Vojtech Kral
3e4aa82ecc imageproc: Use DefaultHasher from stdlib instead of twox-hash 2018-06-25 18:09:45 +02:00
Vojtech Kral
a89768dab0 Remove page.images 2018-06-25 18:09:03 +02:00
Vojtech Kral
4a6244adcf imageproc: Cleanup and comments in hash collision resolution 2018-06-25 18:05:49 +02:00
Vojtech Kral
77bc526008 imageproc: Fix naming, cleanup 2018-06-25 18:05:49 +02:00
Vojtech Kral
6662014e55 Add image resizing support #225 2018-06-25 18:05:04 +02:00