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

Revert "Set admin picture thumbnail quality to 90" #2706

Merged
merged 1 commit into from
Jan 25, 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
6 changes: 1 addition & 5 deletions app/models/alchemy/picture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

module Alchemy
class Picture < BaseRecord
THUMBNAIL_QUALITY = 90

THUMBNAIL_SIZES = {
small: "80x60",
medium: "160x120",
Expand Down Expand Up @@ -197,16 +195,14 @@ def url(options = {})
# Returns an url for the thumbnail representation of the picture
#
# @param [String] size - The size of the thumbnail
# @param [Integer] quality - The quality of the thumbnail
#
# @return [String]
def thumbnail_url(size: "160x120", quality: THUMBNAIL_QUALITY)
def thumbnail_url(size: "160x120")
return if image_file.nil?

url(
flatten: true,
format: image_file_format || "jpg",
quality: quality,
size: size
)
end
Expand Down
3 changes: 1 addition & 2 deletions app/models/concerns/alchemy/picture_thumbnails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +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: picture&.image_file_format || "jpg",
quality: Alchemy::Picture::THUMBNAIL_QUALITY
format: picture&.image_file_format || "jpg"
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@
crop_size: nil,
flatten: true,
format: "jpg",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
end
Expand All @@ -402,7 +401,6 @@
crop_size: nil,
flatten: true,
format: "jpg",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
end
Expand Down
16 changes: 0 additions & 16 deletions spec/models/alchemy/picture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ module Alchemy
expect(picture).to receive(:url).with(
flatten: true,
format: "png",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "160x120"
)
thumbnail_url
Expand All @@ -348,26 +347,11 @@ module Alchemy
expect(picture).to receive(:url).with(
flatten: true,
format: "png",
quality: Alchemy::Picture::THUMBNAIL_QUALITY,
size: "800x600"
)
thumbnail_url
end
end

context "with quality given" do
subject(:thumbnail_url) { picture.thumbnail_url(quality: 50) }

it "returns the url to the thumbnail" do
expect(picture).to receive(:url).with(
flatten: true,
format: "png",
quality: 50,
size: "160x120"
)
thumbnail_url
end
end
end
end

Expand Down
Loading