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

@ -4,7 +4,7 @@ a.black href=package_path(name: pkg.name)
- if pkg.screenshots_approved.any?
// TODO: smarter selection of the most useful screenshot instead of taking the first one
- screenshot = pkg.screenshots.first
= image_tag(screenshot.image.variant(resize: "160x120"), alt: screenshot.caption, class: 'thumbnail')
= image_tag(screenshot.image.variant(resize_to_limit: "160x120"), alt: screenshot.caption, class: 'thumbnail')
- else
img.screenshot.thumbnail src="/images/dummy/no-screenshots-upload-one.svg"
div

View file

@ -20,8 +20,8 @@ h1 =@package.name
- screenshots_visible_to_user(@package).each do |screenshot|
.listview
.text-center
a.black.fancybox href=rails_representation_url(screenshot.image.variant(resize: "800x600")) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.variant(resize: "800x600"), alt: screenshot.caption)
a.black.fancybox href =rails_representation_url(screenshot.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.variant(resize_to_limit: [800,600]), alt: screenshot.caption)
- if screenshot.description
.imgcaption =screenshot.description
- if screenshot.version.present?

View file

@ -32,8 +32,8 @@ h1 = "Upload screenshots for #{@package.name}"
.small-up-1.medium-up-3.large-up-4.grid-thumbnails
- @package.screenshots.all.each do |ss|
.column
a.black.fancybox href=rails_representation_url(ss.image.variant(resize: "800x600")) rel='fancybox-thumb' title=ss.caption
= image_tag(ss.image.variant(resize: "160x120"), alt: ss.caption, class: 'thumbnail')
a.black.fancybox href=rails_representation_url(ss.image.variant(resize_to_limit: "800x600")) rel='fancybox-thumb' title=ss.caption
= image_tag(ss.image.variant(resize_to_limit: "160x120"), alt: ss.caption, class: 'thumbnail')
// = render partial: 'packages/grid_thumbnail', locals: { pkg: pkg }
//- else