Watermark now on east. New method for medium-sized images

This commit is contained in:
Christoph Haas 2020-10-20 21:24:23 +02:00
parent 37bf1d8589
commit c23cfbbba2
2 changed files with 17 additions and 8 deletions

View file

@ -162,11 +162,20 @@ class Screenshot < ApplicationRecord
#Digest::MD5.base64digest(Net::HTTP.get(URI(url)))
end
# Returns the URL that links to a full-size screenshot image with a watermark
def large_watermarked
# Returns the image variant that links to a full-size screenshot image with a watermark
def medium_image
if self.image.attached?
self.image.variant(
gravity: 'SouthEast',
resize_to_limit: [670, 600]
).processed
end
end
# Returns the image variant that links to a medium-size screenshot for the details page
def large_image_watermarked
if self.image.attached?
self.image.variant(
gravity: 'East',
draw: 'image Over 0,0 0,0 "public/logo/watermark.png"'
).processed
end

View file

@ -19,9 +19,9 @@
.margin-bottom-3
/ TODO: de-duplicate
a href =url_for(screenshot.large_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
a href =url_for(screenshot.large_image_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
.image-with-zoom-icon
= image_tag(url_for(screenshot.image), alt: screenshot.caption, class: 'thumbnail')
= image_tag(url_for(screenshot.medium_image), alt: screenshot.caption, class: 'thumbnail')
.magnifying-glass-icon
i.fa.fa-search
@ -34,12 +34,12 @@
/ Display further screenshots as smaller images
- else
.small-6.medium-6.cell
.small-12.medium-6.cell
.margin-bottom-3
a href =url_for(screenshot.large_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
a href =url_for(screenshot.large_image_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
.image-with-zoom-icon
= image_tag(url_for(screenshot.image), alt: screenshot.caption, class: 'thumbnail')
= image_tag(url_for(screenshot.medium_image), alt: screenshot.caption, class: 'thumbnail')
.magnifying-glass-icon
i.fa.fa-search