aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 08:41:48 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 08:41:48 +0000
commit5a1862223c89d1b2570b99c6e95b997bf4b42c3c (patch)
treed8fa411aae41f6b09f3c64179e8d564cc4dedfe6
parentdf5b04f6be5b6187445fd2f084ebbf5a045bea5d (diff)
snapshot jpg filename is now includes resource name
-rw-r--r--app/controllers/pdfresources_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/pdfresources_controller.rb b/app/controllers/pdfresources_controller.rb
index a7df8d8..f1634a2 100644
--- a/app/controllers/pdfresources_controller.rb
+++ b/app/controllers/pdfresources_controller.rb
@@ -70,9 +70,10 @@ class PdfresourcesController < ApplicationController
end
if File.exist?(reduced_image_path)
+ fn = resource.name.strip.downcase.gsub("\s", "_") << "_page-"
image_blob = ActiveStorage::Blob.create_and_upload!(
io: File.open(reduced_image_path),
- filename: "page-#{index + 1}.jpg",
+ filename: "#{fn}#{index + 1}.jpg",
content_type: 'image/jpg'
)
resource.pdf_snapshots.attach(image_blob)