Use resize_to_limit to avoid stretching images

This commit is contained in:
Christoph Haas 2020-08-17 01:48:51 +02:00
parent 53911f226d
commit b70a9f1a07
7 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
json.package @p.name
json.screenshots @p.screenshots do |s|
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "160x120", timestamp: false)}"
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "800x600", timestamp: false)}"
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize_to_limit: "160x120", timestamp: false)}"
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize_to_limit: "800x600", timestamp: false)}"
json.version s.version
end

View file

@ -4,7 +4,7 @@ json.cache! ['json_screenshots'], expires_in: 1.hour do
json.extract! s, :version
json.extract! p, :maintainer, :name, :section, :maintainer_email, :homepage, :description
json.url package_url(p.name, protocol: 'https')
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "160x120")}"
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "800x600")}"
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize_to_limit: "160x120")}"
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize_to_limit: "800x600")}"
end
end