From 5d17b4b7e41a62d2c7f1dabae8ad7376211e921a Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 28 Jan 2013 11:55:45 +0100 Subject: thumbnails fixed --- app/controllers/trigger_controller.rb | 1 + app/models/fax_document.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index c49e0b9..ac43832 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -101,6 +101,7 @@ class TriggerController < ApplicationController File.delete(pdf_file); fax_document.tiff = nil fax_document.save + fax_document.render_thumbnails else fax_document.state = 'unsuccessful' fax_document.save diff --git a/app/models/fax_document.rb b/app/models/fax_document.rb index 080bdaa..be689e2 100644 --- a/app/models/fax_document.rb +++ b/app/models/fax_document.rb @@ -52,7 +52,6 @@ class FaxDocument < ActiveRecord::Base name end - private def render_thumbnails directory = "/tmp/GS-#{GsParameter.get('GEMEINSCHAFT_VERSION')}/fax_thumbnails/#{self.id}" system('mkdir -p ' + directory) @@ -66,7 +65,8 @@ class FaxDocument < ActiveRecord::Base system("rm -rf #{directory}") self.update_attributes(:document_total_pages => number_of_thumbnails) if self.document_total_pages.nil? end - + + private def convert_pdf_to_tiff page_size_a4 = '595 842' page_size_command = "<< /Policies << /PageSize 3 >> /InputAttributes currentpagedevice /InputAttributes get dup { pop 1 index exch undef } forall dup 0 << /PageSize [ #{page_size_a4} ] >> put >> setpagedevice" -- cgit v1.2.3