Skip to content

Commit

Permalink
Revert "Use WebP for all thumbnails"
Browse files Browse the repository at this point in the history
This reverts commit 5ba02c1.
  • Loading branch information
tvdeyen committed Jan 22, 2024
1 parent f26694f commit dfcd41e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/models/alchemy/picture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def thumbnail_url(size: "160x120")

url(
flatten: true,
format: "webp",
format: image_file_format || "jpg",
size: size
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/alchemy/picture_thumbnails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def thumbnail_url_options
crop_from: crop && crop_from.presence || default_crop_from&.join("x"),
crop_size: crop && crop_size.presence || default_crop_size&.join("x"),
flatten: true,
format: "webp"
format: picture&.image_file_format || "jpg"
}
end

Expand Down
12 changes: 6 additions & 6 deletions lib/alchemy/test_support/having_picture_thumbnails_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
allow(record).to receive(:settings) { settings }
end

it "includes webp file format." do
expect(thumbnail_url).to match(/\.webp/)
it "includes the image's original file format." do
expect(thumbnail_url).to match(/\.png/)
end

it "flattens the image." do
Expand Down Expand Up @@ -305,8 +305,8 @@
create(:alchemy_picture)
end

it "uses webp image format." do
expect(thumbnail_url_options[:format]).to eq("webp")
it "includes the image's original file format." do
expect(thumbnail_url_options[:format]).to eq("png")
end

it "flattens the image." do
Expand Down Expand Up @@ -381,7 +381,7 @@
crop_from: nil,
crop_size: nil,
flatten: true,
format: "webp",
format: "jpg",
size: "160x120"
)
end
Expand All @@ -400,7 +400,7 @@
crop_from: nil,
crop_size: nil,
flatten: true,
format: "webp",
format: "jpg",
size: "160x120"
)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/alchemy/picture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ module Alchemy
it "returns the url to the thumbnail" do
expect(picture).to receive(:url).with(
flatten: true,
format: "webp",
format: "png",
size: "160x120"
)
thumbnail_url
Expand All @@ -346,7 +346,7 @@ module Alchemy
it "returns the url to the thumbnail" do
expect(picture).to receive(:url).with(
flatten: true,
format: "webp",
format: "png",
size: "800x600"
)
thumbnail_url
Expand Down

0 comments on commit dfcd41e

Please sign in to comment.