From 0da4b82ee4dc1ba52b5005900359fb4902fea306 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Fri, 26 Apr 2024 20:38:41 +0300 Subject: [PATCH] Add `fill`, `focus_x`, and `focus_y` arguments to the `video_thumbnail_tile` processing option --- CHANGELOG.md | 1 + lib/imgproxy/options_casters/video_thumbnail_tile.rb | 3 +++ spec/url_for_spec.rb | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ade29..bb914fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Added - Add `smart_subsample` argument to the `webp_options` processing option. - Add `watermark_rotate` processing option support. +- Add `fill`, `focus_x`, and `focus_y` arguments to the `video_thumbnail_tile` processing option. ### Fixed diff --git a/lib/imgproxy/options_casters/video_thumbnail_tile.rb b/lib/imgproxy/options_casters/video_thumbnail_tile.rb index bc9b983..145bbac 100644 --- a/lib/imgproxy/options_casters/video_thumbnail_tile.rb +++ b/lib/imgproxy/options_casters/video_thumbnail_tile.rb @@ -17,6 +17,9 @@ module VideoThumbnailTile tile_height: Imgproxy::OptionsCasters::Integer, extend_tile: Imgproxy::OptionsCasters::Bool, trim: Imgproxy::OptionsCasters::Bool, + fill: Imgproxy::OptionsCasters::Bool, + focus_x: Imgproxy::OptionsCasters::Float, + focus_y: Imgproxy::OptionsCasters::Float, ).freeze def self.cast(raw) diff --git a/spec/url_for_spec.rb b/spec/url_for_spec.rb index 568feb9..dad91fe 100644 --- a/spec/url_for_spec.rb +++ b/spec/url_for_spec.rb @@ -195,6 +195,9 @@ tile_height: 100, extend_tile: true, trim: true, + fill: true, + focus_x: 0.25, + focus_y: 0.75, }, fallback_image_url: "https://images.test/fallback.jpg", skip_processing: %w[gif svg], @@ -277,7 +280,7 @@ "da:1", "vts:15", "vtk:1", - "vtt:1.5:2:3:200:100:1:1", + "vtt:1.5:2:3:200:100:1:1:1:0.25:0.75", "fiu:aHR0cHM6Ly9pbWFnZXMudGVzdC9mYWxsYmFjay5qcGc", "skp:gif:svg", "raw:1", @@ -352,7 +355,7 @@ "disable_animation:1", "video_thumbnail_second:15", "video_thumbnail_keyframes:1", - "video_thumbnail_tile:1.5:2:3:200:100:1:1", + "video_thumbnail_tile:1.5:2:3:200:100:1:1:1:0.25:0.75", "fallback_image_url:aHR0cHM6Ly9pbWFnZXMudGVzdC9mYWxsYmFjay5qcGc", "skip_processing:gif:svg", "raw:1",