From 83d450c445a4121e0a93936c4afcf10cb41eb286 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Fri, 12 Jul 2019 07:40:18 +0200 Subject: [PATCH] Simplify generation of PDF previwe files --- lib/paperclip_processors/custom_file_preview.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/paperclip_processors/custom_file_preview.rb b/lib/paperclip_processors/custom_file_preview.rb index 8c95bf23b..01e2b57cc 100644 --- a/lib/paperclip_processors/custom_file_preview.rb +++ b/lib/paperclip_processors/custom_file_preview.rb @@ -12,17 +12,10 @@ module Paperclip begin if @file.content_type == 'application/pdf' - content = Paperclip.run( + Paperclip.run( pdftoppm_path, - "-singlefile -r 72 -png #{@file.path}" + "-singlefile -r 72 -png #{@file.path} #{File.join(directory, basename)}" ) - - # Save intermediate content to tempfile - tmp = TempfileFactory.new.generate - tmp.write(content) - tmp.rewind - - original_preview_file = tmp.path else Paperclip.run( libreoffice_path,