From 5a1862223c89d1b2570b99c6e95b997bf4b42c3c Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 14 Nov 2024 08:41:48 +0000 Subject: snapshot jpg filename is now includes resource name --- app/controllers/pdfresources_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3