aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 08:32:55 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 08:32:55 +0000
commitdf5b04f6be5b6187445fd2f084ebbf5a045bea5d (patch)
treea0a1018a632279c6a9a4583169b0ad4a41a90874
parent05a673ebafaea9b2f672b9a23884dd51927f71e5 (diff)
pdf snapshotting now reduces size of image
-rw-r--r--app/controllers/pdfresources_controller.rb5
-rw-r--r--app/views/pdfresources/_pdfresource.html.erb5
2 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/pdfresources_controller.rb b/app/controllers/pdfresources_controller.rb
index dfcb702..a7df8d8 100644
--- a/app/controllers/pdfresources_controller.rb
+++ b/app/controllers/pdfresources_controller.rb
@@ -62,7 +62,10 @@ class PdfresourcesController < ApplicationController
image_reduced = MiniMagick::Tool::Magick.new do |magick|
magick << image_path
magick << "-quality"
- magick << "20"
+ magick << "40"
+ magick.strip
+ magick << "-resize"
+ magick << "50%"
magick << reduced_image_path
end
diff --git a/app/views/pdfresources/_pdfresource.html.erb b/app/views/pdfresources/_pdfresource.html.erb
index 3c8b3a8..12b2b58 100644
--- a/app/views/pdfresources/_pdfresource.html.erb
+++ b/app/views/pdfresources/_pdfresource.html.erb
@@ -32,7 +32,10 @@
<div class="my-5">
<strong class="block font-medium mb-1">Snapshots:</strong>
<% pdfresource.pdf_snapshots.each do |image| %>
- <div><%= link_to image.filename, image %></div>
+ <div>
+ <%= image_tag url_for(image) %>
+ <%= link_to image.filename, image %>
+ </div>
<% end %>
</div>