Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.1] Revert WebP thumbnails #2703

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/alchemy/picture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def thumbnail_url(size: "160x120", quality: THUMBNAIL_QUALITY)

url(
flatten: true,
format: "webp",
format: image_file_format || "jpg",
quality: quality,
size: size
)
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",
quality: Alchemy::Picture::THUMBNAIL_QUALITY
}
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",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
Expand All @@ -401,7 +401,7 @@
crop_from: nil,
crop_size: nil,
flatten: true,
format: "webp",
format: "jpg",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
Expand Down
6 changes: 3 additions & 3 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",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
Expand All @@ -347,7 +347,7 @@ module Alchemy
it "returns the url to the thumbnail" do
expect(picture).to receive(:url).with(
flatten: true,
format: "webp",
format: "png",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "800x600"
)
Expand All @@ -361,7 +361,7 @@ module Alchemy
it "returns the url to the thumbnail" do
expect(picture).to receive(:url).with(
flatten: true,
format: "webp",
format: "png",
quality: 50,
size: "160x120"
)
Expand Down
Loading