Skip to content

Commit

Permalink
Merge pull request #2706 from tvdeyen/revert-thumbnail-quality
Browse files Browse the repository at this point in the history
Revert "Set admin picture thumbnail quality to 90"
  • Loading branch information
tvdeyen authored Jan 25, 2024
2 parents f67b14c + d7bf0eb commit 05ada94
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
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

0 comments on commit 05ada94

Please sign in to comment.